Formated Text lost in Body

E

E.Zenker

Hi
i have the code:
Sub Vorlage_aufrufen()
' Dim Vorlage
' Dim TextausVorlage
' Dim Adresse
'Set myOlApp = CreateObject("Outlook.Application")
' Set Vorlage = Application.CreateItemFromTemplate("C:\......*.oft")
' Vorlage.To = Item.Email1Address
' Vorlage.Subject = "Betreff reinschreiben"
' Vorlage.Attachments.Add "C:\........*.pdf"
' TextausVorlage = Vorlage.Body
' Adresse = Item.CompanyName'+ vbCr
' Adresse = Adresse + Item.BusinessAddressStreet + vbCr
' Adresse = Adresse + Item.BusinessAddressPostalCode + " "
' Adresse = Adresse + Item.BusinessAddressCity + vbCr +
vbCr
' Adresse = Adresse + Item.Title + " " + Item.LastName +
vbCr + vbCr
' Vorlage.Body = TextausVorlage + Adresse
' Text = "Guten Tag," + Item.Title + " " + Item.LastName + vbCr +
vbCr


'End Sub

when i fill in the adress to the body the format of the text from the
template in body ist lost.
what must i do to keep the format of the template text?
is there a better or other way to do this?

Thanks for surggestions
E.Zenker
 
D

Dmitry Streblechenko

Same property: HTMLBody. Read it using MailItem.HTMLBody, modify it, then
set MailItem.HTMLBody .
Note that you cannot simply concatenate HTML strings, then need to be
merged.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
E

E.Zenker

Thank you very much for your reply,

I tried to find how to merge but could not find an example.
In MS VB library I only found the "msoShapeFlowchartMerge" statement.

So please can you tell me how to merge strings in html.body with an example
to help me.

Thank you
E. Zenker
 
D

Dmitry Streblechenko

What I mean is that if you have an HTML body like
<html><body>test</body></html>
and you want to add an extra line (line (<b>bolded text</b>) you cannot
simply concatenate the two. The extra line must be inserted before the
</body> tag. Either do you own parsing or load the HTML into an instance of
the IHTMLDocument object and manipulate the HTML using DOM, then stream it
out.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top