Consulting

Results 1 to 5 of 5

Thread: Solved: Sending an Outlook message from Excel

  1. #1

    Solved: Sending an Outlook message from Excel

    Hi, I'm a beginner in VBA, but excited about the possibilities.

    I work with Office 2007. Is there anyone who can give me some VBA code that - when run in Excel 2007 - will generate and send an email message where I can enter Recipient, Subject, Body text and File attachment? I plan to have a list of recipients in Excel and write a routine that will go down the list and send all e-mail messages for me.

    Many thanks!

    Peter

  2. #2
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    Take a look at Ron De Bruins site on this matter:
    http://www.rondebruin.nl/sendmail.htm

    When you have got to grips with it you can then substitute SUBJECT, BODY etc with the contents of userform textbox
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  3. #3
    VBAX Newbie
    Joined
    Aug 2010
    Posts
    5
    Location
    You can find good article with examples frm rondebruin.nl.

  4. #4
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    Assuming all your email addresses are in column A sheet1 and are text rather than mailto hyperlinks, if they're hyperlinks then run this first[VBA]Sub BreakMailLinks()
    Cells.Hyperlinks.Delete
    End Sub[/VBA]Then import the .frm from the file attached, it should work fine for you!

    I've just edited Ron De Bruins sendmail a little, but you get the idea if you want to use his cdo version so that you dont keep getting the security warning.
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  5. #5

    Thanks - this works better than I thought!

    Simon,

    Thanks for your help. I did not expect such a fast response that was so on the mark. Ron de Bruin is a genius - I looked at some of his examples, took the simplest one and adjusted it until I was happy. Really quite powerful stuff. Many thanks, Peter

Posting Permissions

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