I cannot this thing to format properly.
If I go to a new E-mail manually after running my program and hit CTRL-V it
looks perfect in the body of the E-mail.
Via my program it shows HTML code or if I use text it reads perfectly just
loses the format.
I've tried.
HTM
DOC
RTF
DOCX
formats by saving via Word 2007.
Steve
I ran this with both the DOC and HTM versions of the same document.
I've been playing with this all morning and here is my code:
Dim WordDoc As Microsoft.Office.Interop.Word.Document
WordDoc = AppWord.Documents.Open(WordFileName)
WordDoc.Content.Select()
WordDoc.Content.Copy()
Dim objClipboard As IDataobject = Clipboard.GetDataObject()
'WordContent = WordDoc.Content.Text
WordContent = objClipboard.GetData(DataFormats.Html)
WordDoc.Close()
WordDoc = Nothing
AppWord.Quit()
In My E-mail routine.......
myMailItem.HTMLBody = msg
Results in E-mail.....
Version:1.0 StartHTML:0000000153 EndHTML:0000024428
StartFragment:0000020677
EndFragment:0000024388 SourceURL:file:///C:\temp\Brokers%20Letter.doc
ÂÂÂÂÂÂÂÂÂÂÂThis email is to inform you .................................
ÂÂÂÂÂÂÂÂÂÂÂAs you may know,.........................
Can you get the document's RTF text? If so, this is what you need to
be converting to html, I don't using the DataFormats.Html will convert
the file into the required html.
Also, if the document you need to send is the same, why not rewrite
the email contents in Html to start with? Word comes with an html
editor so it shouldn't be a very big deal.
Thanks,
Seth Rowe