That's the ticket.
New code looks like this:
Dim myOlApp As Outlook.Application
Dim objMailMessage As MailItem
Dim stBody As String
Set myOlApp = Outlook.Application
Set objMailMessage = myOlApp.CreateItemFromTemplate("C:\Users\Desktop\template.oft")
stBody = "xyz example"
stReplace =...
.Display instead of .Save does indeed work, however, the changes made to the email message via the Replace function revert back to the template's text when the email is closed and saved as a draft.
.Send also works, in that the applied changes take effect, however, I do not want the emails I...
Saving the replaced value in a variable and then assigning that variable to the .HTMLBody property doesn't work either.
I don't know why the resulting string wouldn't be a properly formatted HTML string -the format of the dynamic string was never a problem before, and it wasn't changed after...
Do you mean to just simply insert a line of text into the HTMLBody rather than attempt to replace it?
EX:
With objMailMessage
.To = "Example, Test"
.Subject = "Testing"
.BodyFormat = olFormatHTML
.HTMLBody = "Static string test"
.Save
End With
If so, that doesn't seem to...
The Replace() function works in the Immediate Window.
When I do a Debug.Print on the .HTMLBody property before and after the Replace() function line, the Immediate Window reflects that the change has occured, however, the email draft does not reflect said change.
My company recently upgraded our MS Office from 2007 to 2010 (except for Access).
Previously, when I had Access 2007 and Outlook 2007, I had a process that generated 50+ dynamic emails from an Outlook template file (.oft).
The code would loop through a listbox and replace the template's...