+ Reply to Thread
Results 1 to 5 of 5

Excel VBA Outlook Email Help!

  1. #1
    Registered User
    Join Date
    07-13-2015
    Location
    London
    MS-Off Ver
    2013
    Posts
    4

    Excel VBA Outlook Email Help!

    Hi all,

    I have tried various websites and methods but I appear to be a little out of my depth. I would like excel to if Column AB = Yes to send an email via Outlook to an email address listed in Column W and for the persons name to be included in the email (Column V) along with other Column cells too which meet the criteria of AB = Yes.

    The email I am hoping to create would be:

    Dear (Column V)

    Regarding (Column A) and (Column B)

    The above named member of staff has been absent since (Column F) and was last contacted on (Column AA). Please arrange to make contact with the member of staff as soon as possible and complete the attached form and return to XXXXXXX


    Your help with this would be appreciated, this is the code I have so far:

    Please Login or Register  to view this content.
    Thank you in advance!
    Last edited by lqv81s; 07-13-2015 at 05:43 PM.

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Excel VBA Outlook Email Help!

    I'm a fan of HTMLBody over plain ol' Body for the ease with which you can coerce Outlook to change font, size, color, etc. Incorporating the text <br> as a line break gets you a next line. From there you're just concatenating all of your values together.

    Please Login or Register  to view this content.

    Instead of a clump like I've put together here, I tend to Dim out a number of strVariables and then concatenate them together at the very end, such as:

    Please Login or Register  to view this content.
    Last edited by daffodil11; 07-13-2015 at 05:55 PM.
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Registered User
    Join Date
    07-13-2015
    Location
    London
    MS-Off Ver
    2013
    Posts
    4
    Thank you for your help, I have amended my original post to comply with the forum rules. I will give this a try in the office tomorrow and let you know how I get on. Thank you once again

    Quote Originally Posted by daffodil11 View Post
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    I'm a fan of HTMLBody over plain ol' Body for the ease with which you can coerce Outlook to change font, size, color, etc. Incorporating the text <br> as a line break gets you a next line. From there you're just concatenating all of your values together.

    Please Login or Register  to view this content.

    Instead of a clump like I've put together here, I tend to Dim out a number of strVariables and then concatenate them together at the very end, such as:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    07-13-2015
    Location
    London
    MS-Off Ver
    2013
    Posts
    4
    This worked a treat, thank you so much for your help!
    One other quick question if I may...
    I need to send an email if a cell value is greater than 20 but to only do this once per row. Your help would be much appreciated.



    Quote Originally Posted by lqv81s View Post
    Thank you for your help, I have amended my original post to comply with the forum rules. I will give this a try in the office tomorrow and let you know how I get on. Thank you once again

  5. #5
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Excel VBA Outlook Email Help!

    That type of logic is what I use most often. For each row, If or Select Case, and then send an email. It works very well with Access per record also.


    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. vba pull data from outlook body of email through email or subject of mail into excel
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-01-2014, 04:37 AM
  2. Outlook Email via Excel
    By aijp in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-20-2013, 05:34 PM
  3. export outlook 2007 email into excel with subject and body of email
    By akulka58 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-25-2013, 02:37 PM
  4. How to parse data in Outlook email using HTML version of email back to excel
    By bnasty in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 10-31-2012, 02:54 PM
  5. Replies: 2
    Last Post: 08-01-2012, 02:47 PM
  6. [SOLVED] Excel email: Outlook not recognizing email ID
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-16-2012, 10:03 AM
  7. Outlook Email via Excel
    By stevetothink in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 11-30-2010, 12:19 PM
  8. Email using Excel VBA and Keeping Outlook Signature on the Email
    By Shama in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-13-2009, 07:39 PM

Tags for this Thread

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