+ Reply to Thread
Results 1 to 8 of 8

Sending outlook mail using VBA

  1. #1
    Registered User
    Join Date
    09-03-2010
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    19

    Sending outlook mail using VBA

    Hi,

    I want an email to be sent, which contains a link to the workbook once a user has filled in a userform and clicks a button on the userform. I have the following code:

    Please Login or Register  to view this content.
    However, I'm always getting invalid qualifier or variable not defined. Could someone please help? Thanks in advance! =)

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Sending outlook mail using VBA

    The continuation character in

    Please Login or Register  to view this content.
    might be to blame. Try removing it.
    Martin

  3. #3
    Registered User
    Join Date
    09-03-2010
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Sending outlook mail using VBA

    It didn't work =(
    Now I'm getting:
    Run-error
    Automation error
    invalid syntax

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Sending outlook mail using VBA

    Hello icylemontea,

    I am not really familiar with the Mac Excel 2004, other than there are many differences between the PC and Mac, especially in the use of advanced code. I have contacted another moderator who is very familiar with Macs to take a look at your post.

    Just so we are all on the same page, do you want to include a hyperlink in the email body or do you want to include the URL text? It was not clear to me which you wanted.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  5. #5
    Registered User
    Join Date
    09-03-2010
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Sending outlook mail using VBA

    Hi Leith,

    Sorry, I'm actually on a different computer using excel 2010 at the moment.
    Regarding the body of the email, I wanted a hyperlink to the excel file.

    Thanks for your help

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Sending outlook mail using VBA

    Hello icylemontea,

    Please update your profile to include Excel 2010. It will help everybody when answering any questions you have. As for the link, it has to added in HTML, which you can do in Outlook. Instead of Body you have to use htmlBody. The message must be a string that includes the proper HTML tags for formatting and to provide the link.I can code this for you if you want.

  7. #7
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Sending outlook mail using VBA

    It's rather curious to have the property .Readreceiptrequested
    set to False after sending the mail.
    I don't know whether it's possible to show the mail after sending it (outlook.display).
    I also fear that you didn't put something into 'NameOfWorkbook'
    try this:

    Please Login or Register  to view this content.
    Last edited by snb; 09-12-2010 at 05:31 AM.



  8. #8
    Registered User
    Join Date
    09-03-2010
    Location
    england
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Sending outlook mail using VBA

    Hi,

    I changed

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    and that seems to have done the trick.
    Thanks guys for your help.

    Leith, would you mind showing me the coding for .htmlbody?
    Thanks a lot!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1