Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    May 2002
    Location
    Toronto, Ontario, Canada
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Build email within Excel (Excel/Outlook 2003)

    Hi All,

    Here's what I'm trying to do.

    The user clicks a button on Sheet A. Some code runs that:
    <UL><LI>creates a new email
    <LI>adds a bunch of recipients
    <LI>adds a subject line
    <LI>adds Sheet B as an attachment (in a separate .xls file)
    <LI>inserts an area from Sheet C (a named range) into the body of the email
    <LI>inserts the user's outlook signature at the bottom of the body of the email
    <LI> adds voting buttons ("Approve;Reject")
    <LI> sends the email[/list]I know how to do some of that... I'm specifically looking for help with the vba for building the body of the email and adding the voting buttons.

    Any help would be very much appreciated! <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Build email within Excel (Excel/Outlook 2003)

    I assume that you're using Automation to control Outlook from within Excel.
    The MailItem object in Outlook VBA has a Body property that you can use to specify the (unformatted) body text. For example:

    Dim objMail As Outlook.MailItem
    Set objMail = ...
    objMail.Body = "First paragraph" & vbCrLf & vbCrLf & "Second paragraph" & vbCrLf & "Third Paragraph"

    If you want to specify formatting in an HTML format e-mail, you can use the HTMLBody property. This allows the use of HTML tags such as and .

    You can specify voting buttons like this:

    objMail.VotingOptions = "Yes;No;Maybe"

  3. #3
    3 Star Lounger
    Join Date
    May 2002
    Location
    Toronto, Ontario, Canada
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Build email within Excel (Excel/Outlook 2003)

    You're right Hans. I am using Automation.

    Why does it always seem so simple when you see the solution. I had found the VotingOptions property for the MailItem object but there were no examples anywhere of the statements setting the values. I thought it might have been a True/False thing instead of what I was really looking for. MSDN had "expression.votingoptions" and that was it. I suppose I should have played around more before asking the question.

    Thank you Hans! As always, you are the best! <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

Posting Permissions

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