+ Reply to Thread
Results 1 to 5 of 5

Create Outlook mail with dynamic .Body and static .HTMLBody

  1. #1
    Forum Contributor
    Join Date
    03-24-2009
    Location
    Vietnam
    MS-Off Ver
    Excel 2010
    Posts
    382

    Create Outlook mail with dynamic .Body and static .HTMLBody

    Hi,

    I am using the below code to generate an email from excel in outlook and add in some recipient details from the currently activate column. The email will be generated after clicking on a shape on top of the column and the recipients data should be taken from several rows in that column:

    Please Login or Register  to view this content.
    Now my issue is following:
    1. When clicking on the shape, the cell is not activated, therefore excel doesnt know in which column I am and which rows it should take the data from.
    2. The body message is taken from my "ThankYouNote_Format" sheet and is then converted to HTML. The message body is generic, but I would need the first line of the body to be a dynamic "Dear Mr. / Ms. XXX," with the data from the column's rows.

    Suggestions are welcome
    A2k

  2. #2
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,060

    Re: Create Outlook mail with dynamic .Body and static .HTMLBody

    see if it helps you, add the rest of yr code ...html and attachment
    Please Login or Register  to view this content.
    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

  3. #3
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Create Outlook mail with dynamic .Body and static .HTMLBody

    part 1
    Please Login or Register  to view this content.
    rename to whatever the shape is called
    will give address of the top left corner of your shape
    Last edited by humdingaling; 08-05-2014 at 03:31 AM. Reason: re worded
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  4. #4
    Forum Contributor
    Join Date
    03-24-2009
    Location
    Vietnam
    MS-Off Ver
    Excel 2010
    Posts
    382

    Re: Create Outlook mail with dynamic .Body and static .HTMLBody

    Nope, sorry guys but all this wont work.

    For one, I have about 200 copy&paste shapes, I dont want to go through all of them and assign individual macros where I have to define the shape name. When copying this 200 times I would have to rename from "shape1" to "shape200"... No thanks

    For John55's sample, your date is in one row and then split among coumns, my data is in a column and then split across rows. Even when adjusting that, I run into a problem when trying to send both a HTML body as well as a regular outlook body where I just want to greet the recipient ("Dear Mr. / Ms. XXX") with data from the worksheet. Its either normal body or HTMLbody...

    Thanks though

    EDIT: just played around a bit with application.caller and got a good result with this code:
    Please Login or Register  to view this content.
    Last edited by Armitage2k; 08-05-2014 at 04:44 AM.

  5. #5
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,060

    Re: Create Outlook mail with dynamic .Body and static .HTMLBody

    sorry, I am not a mind reader!

+ 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. [SOLVED] Change Font formatting mid-sentence of HTMLBody Outlook mail
    By askpcguy in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-31-2014, 09:47 PM
  2. Format Outlook Mail Body using VBA
    By prabhubox@yahoo.com in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-27-2014, 07:02 AM
  3. Excel VBA outlook - Range in mail body
    By dphadke@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-25-2013, 06:33 AM
  4. sending mail in outlook with image in Top center of body .
    By yogananda.muthaiah in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-25-2012, 05:06 PM
  5. Send e-mail with image on body (.html) on e-mail manager <> outlook
    By mariotnc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-05-2012, 09:28 PM

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