Results 1 to 3 of 3

Thread: Sending a single worksheet as an outlook body [RESOLVED]

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2003
    Posts
    35

    Sending a single worksheet as an outlook body [RESOLVED]

    I would like to be able to send a single sheet (not whole workbook) as the body (not attachment) of an Outlook mail. This is the best I can do but it only attaches the sheet to the mail:

    Code:
    Worksheets("Redemptions").Select
    ActiveSheet.Copy
    Application.Dialogs(xlDialogSendMail).Show "[email protected]", "My Subject"
    I would be grateful for any ideas
    Last edited by jrpfinch; Aug 29th, 2003 at 08:46 AM.

  2. #2
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    Trying to get Outlook to do something other than simple text in its .BODY property is not easy.
    You will typically do better to create an HTML file, and use the .HTMLBody property in Outlook.

    VB Code:
    1. set out=WScript.CreateObject("Outlook.Application")
    2. set mapi=out.GetNameSpace("MAPI")
    3.     set email=out.CreateItem(0)
    4.     email.Recipients.Add("[email protected]")
    5.     email.Subject = "Test"
    6.     email.Body = "Test of HTML"
    7.     email.Send
    8.     Set outlook=Nothing
    9.     Set mapi=Nothing
    Instead of using the .Body property above, try using the .HTMLbody property (which I hope exists from the VBScript / VBA environment).
    olMail.HTMLBody = "<htmlbody><font color=#0000FF><p><b>New Invoice Numbers:</b></font><BR>" & myvar & "</htmlbody>"

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2003
    Posts
    35

    Thanks

    Thanks

    I sussed it

    BTW This site is very good for demonstrating how to send excel sheets as the body of an outlook mail


    http://www.dicks-clicks.com/excel/olSending.htm

    It's not a porn site don't worry

Posting Permissions

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



Click Here to Expand Forum to Full Width