vegard_fv
03-03-2016, 03:04 AM
Hi guys,
When using the beneath code to forward emails in Outlook VBA, everything works perfectly, and the HTML-formatting is kept. But what I would like to do, is to write a text to the reciever on top of the email. That's when my worries begin.
I've tried adding the following lines to the code:
fwdbody = fwd.Body
With fwd
.BodyFormat = olFormatHTML
.HTMLBody = "<HTML><BODY>Hi there, please see the beneath forwarded email that I would like you to respond to"</BODY></HTML> _
& fwdbody
This does work technically - BUT it changes the sweet HTML-formatting, and turning the forwarded message into a big soup of black, ugly text :banghead:
What I would LOVE, is to KEEP the formatting as it looks when using the beneath code, but be able to ADD a message on top KEEPING the pretty HTML-look :guitar2:
Any hints?
Sub emailforwarding()
Dim olApp As New Outlook.Application
Dim olExp As Outlook.Explorer
Dim olSel As Outlook.Selection
Dim olNameSpace As Outlook.NameSpace
Dim olArchive As Outlook.Folder
Dim intItem As Integer
Dim fwdbody As String
Set olExp = olApp.ActiveExplorer
Set olSel = olExp.Selection
Set olNameSpace = olApp.GetNamespace("MAPI")
'Starts a loop for each selected email as item
For intItem = 1 To olSel.Count
Set fwd = olSel.Item(intItem).Forward
'Add email adress - I do it with adding a variable
fwd.Recipients.Add 'write your email-adress here as text string
fwd.Send
Next intItem
End Sub
When using the beneath code to forward emails in Outlook VBA, everything works perfectly, and the HTML-formatting is kept. But what I would like to do, is to write a text to the reciever on top of the email. That's when my worries begin.
I've tried adding the following lines to the code:
fwdbody = fwd.Body
With fwd
.BodyFormat = olFormatHTML
.HTMLBody = "<HTML><BODY>Hi there, please see the beneath forwarded email that I would like you to respond to"</BODY></HTML> _
& fwdbody
This does work technically - BUT it changes the sweet HTML-formatting, and turning the forwarded message into a big soup of black, ugly text :banghead:
What I would LOVE, is to KEEP the formatting as it looks when using the beneath code, but be able to ADD a message on top KEEPING the pretty HTML-look :guitar2:
Any hints?
Sub emailforwarding()
Dim olApp As New Outlook.Application
Dim olExp As Outlook.Explorer
Dim olSel As Outlook.Selection
Dim olNameSpace As Outlook.NameSpace
Dim olArchive As Outlook.Folder
Dim intItem As Integer
Dim fwdbody As String
Set olExp = olApp.ActiveExplorer
Set olSel = olExp.Selection
Set olNameSpace = olApp.GetNamespace("MAPI")
'Starts a loop for each selected email as item
For intItem = 1 To olSel.Count
Set fwd = olSel.Item(intItem).Forward
'Add email adress - I do it with adding a variable
fwd.Recipients.Add 'write your email-adress here as text string
fwd.Send
Next intItem
End Sub