More Outlook Resource Sites

Microsoft Developer Network (MSDN)

FAQs and other general resources

forum 01-Aug-2014 00:43

Looking for help with Outlook programming projects — VSTO, add-ins, VBA, custom Outlook forms, etc.? You′ve come to the right place!

NEW! >> Subscribe to this site via RSS. For more RSS options, see the complete list of feeds on our main news page.

Login Password
Remember me
Register | Send my password
    Page [ 1 ]  
 Outlook and .NET Printer Friendly Version
Writing code with C# and VB.NET to create Outlook add-ins and other projects
Topic
Why won't this work right in 2007 (It does in 2003)
I have the following code where I'm grabing the entire document from Word, and pasting the contents into the body of an Outlook email message (HTML is the default format for my messages). The Word document is in .mht format, and it's a mail merge document that has already been merged.

Here is the code:

object start = WordApp.MergeDoc.Content.Start;
object end = WordApp.MergeDoc.Content.End;
Word.Range range = WordApp.MergeDoc.Range(ref start, ref end);

range.Copy();

//mail is an active outlook mail message object

mail.HTMLBody = (string)Clipboard.GetDataObject().GetData(DataFormats.Html);

In 2003, I'd get the correctly formatted/merged document like this:

Dear Jim:

Thank you for taking the time to talk to me today. etc......

But now, in 2007 I'm getting this:

Version:1.0 StartHTML:0000000195 EndHTML:0000021989 StartFragment:0000020680 EndFragment:0000021949 SourceURL:file:///C:\Users\Bob\Documents\MarketWare\Form_Emails\Thank%20You%20Letter.mht
Dear Jim:

Thank you for taking the time to talk to me today. etc......

What can I do to correct this?

Thanks!!

Bob Bartel
MarketWare
 

  23-Jan-2010  15:16
  23-Jan-2010  18:02   
Beats me. Maybe you'd have better luck sticking with Word objects and working directly Word.Document returned by mail.GetInspector.WordEditor.
  23-Jan-2010  18:12   
I'd love to if the approach works for both 2003/2007. Can you direct me to some documentation where I can become familiar with the object model of the WordEditor?

I have your book Microsoft Outlook 2007 programming...do you cover any of this in there?

Bob
  23-Jan-2010  19:30   
I found it...well, in lots of places...your book and the net. Thanks for giving me the idea.

bob
    Page [ 1 ]