+ Reply to Thread
Results 1 to 4 of 4

outlook htmlbody

  1. #1
    Erin
    Guest

    outlook htmlbody

    From Excel VBA, I am creating an outlook email message. I want to have the
    body contain an html file. Is there any way to load this html from a file,
    instead of having to put into the VBA code?

  2. #2
    Amedee Van Gasse
    Guest

    Re: outlook htmlbody

    Erin shared this with us in microsoft.public.excel.programming:

    > From Excel VBA, I am creating an outlook email message. I want to
    > have the body contain an html file. Is there any way to load this
    > html from a file, instead of having to put into the VBA code?


    You could put it in from a file to a string using the Textstreamobject.
    Essentially, you read the html file, put its content in a string, and
    use that string in your vba code.

    Read the help on that subject, it actually contains a good example.

    --
    Amedee Van Gasse using XanaNews 1.17.3.1
    If it has an "X" in the name, it must be Linux?

    How To Ask Questions The Smart Way
    http://www.catb.org/~esr/faqs/smart-questions.html
    How to Report Bugs Effectively
    http://www.chiark.greenend.org.uk/~sgtatham/bugs.html
    Only ask questions with yes/no answers if you want "yes" or "no" as the
    answer.
    http://homepages.tesco.net/~J.deBoyn...-with-yes-or-n
    o-answers.html

  3. #3
    Patrick Molloy
    Guest

    RE: outlook htmlbody


    Set objOutlook = New Outlook.Application
    Set objEMailMsg = objOutlook.CreateItem(itemtype:=olMailItem)

    'Show mail but don't actually send!
    If sBody <> "" Then
    With objEMailMsg

    .Subject = "P&P Summary for " & REPORTDATE

    .HTMLBody = NameValue(NAV_MESSAGE) & vbCrLf & sBody

    .Display

    End With





    "Erin" wrote:

    > From Excel VBA, I am creating an outlook email message. I want to have the
    > body contain an html file. Is there any way to load this html from a file,
    > instead of having to put into the VBA code?


  4. #4
    Patrick Molloy
    Guest

    RE: outlook htmlbody

    I forgot to alter something.

    NameValue(NAV_MESSAGE) & vbCrLf & sBody

    is simple the path to the html file plus some additional text
    eg
    .HTMLBody = "C:\Demo.html" & vbCRLF & "Hello World!"

    "Patrick Molloy" wrote:

    >
    > Set objOutlook = New Outlook.Application
    > Set objEMailMsg = objOutlook.CreateItem(itemtype:=olMailItem)
    >
    > 'Show mail but don't actually send!
    > If sBody <> "" Then
    > With objEMailMsg
    >
    > .Subject = "P&P Summary for " & REPORTDATE
    >
    > .HTMLBody = NameValue(NAV_MESSAGE) & vbCrLf & sBody
    >
    > .Display
    >
    > End With
    >
    >
    >
    >
    >
    > "Erin" wrote:
    >
    > > From Excel VBA, I am creating an outlook email message. I want to have the
    > > body contain an html file. Is there any way to load this html from a file,
    > > instead of having to put into the VBA code?


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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