ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   outlook htmlbody (https://www.excelbanter.com/excel-programming/326884-outlook-htmlbody.html)

Erin

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?

Patrick Molloy[_2_]

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?


Patrick Molloy[_2_]

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?



All times are GMT +1. The time now is 01:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com