Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / September 2006

Tip: Looking for answers? Try searching our database.

Insert word document/Bookmark into email body

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul - 15 Sep 2006 15:50 GMT
i have a word document and created a bookmark which highlights the text i am
interested in.
i would like to insert the bookmark at the beginning of the email so that a
user's signature appears after the bookmark.
at the moment i i have been able to replace the body of the email with the
bookmark- but this removes the signature- this is to work on new emails- here
is the code:
mItem.Body= bmark
i have tried inserting the bookmark at the beginning of the body:

mItem.Body.Insert(0, bmark)

but this produces an object reference not set error

i am using outlook 2003, with HTMLBodyFormat and Word 2003.

Thanks
Michael Bauer [MVP - Outlook] - 18 Sep 2006 06:36 GMT
Am Fri, 15 Sep 2006 07:50:02 -0700 schrieb Paul:

Try this:

mItem.Body= bmark & vbCRLF & mItem.Body

Signature

Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
 -- www.VBOffice.net --

> i have a word document and created a bookmark which highlights the text i am
> interested in.
[quoted text clipped - 13 lines]
>
> Thanks
Paul - 18 Sep 2006 11:05 GMT
nope-that doesnt work bmark "& operator isnt defined for types
Microsoft.Interop.Word.Bookmarks and String"

what I am really trying to do is instantiate an outlook template and to add
the user's default signature

> Am Fri, 15 Sep 2006 07:50:02 -0700 schrieb Paul:
>
[quoted text clipped - 22 lines]
> >
> > Thanks
Michael Bauer [MVP - Outlook] - 18 Sep 2006 12:10 GMT
Am Mon, 18 Sep 2006 03:05:02 -0700 schrieb Paul:

In a VBA group I assume VBA, not any .NET language, for which I can´t help
you.

Signature

Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
 -- www.VBOffice.net --

> nope-that doesnt work bmark "& operator isnt defined for types
> Microsoft.Interop.Word.Bookmarks and String"
[quoted text clipped - 28 lines]
>>>
>>> Thanks
Sue Mosher [MVP-Outlook] - 22 Sep 2006 13:45 GMT
I think Michael was assuming, by the way you wrote your mItem.Body= bmark statement, that bmark was a string variable holding the text from your bookmark. In that case, bmark & mItem.Body should be a legitimate string expression in VB.Net. If, however, it's a Word.Bookmark object, then you need to get the text first from Bookmark.Range.Text.

In any case, if the message is in HTML format, you would need to use HTMLBody, not Body, to preserve the formatting. But that's doing things the hard way. Since you have Word as the editor, you should use Word methods. See http://www.outlookcode.com/codedetail.aspx?id=615 for sample code.

Signature

Sue Mosher, Outlook MVP
  Author of Configuring Microsoft Outlook 2003
    http://www.turtleflock.com/olconfig/index.htm
  and Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx
 

> nope-that doesnt work bmark "& operator isnt defined for types
> Microsoft.Interop.Word.Bookmarks and String"
[quoted text clipped - 28 lines]
>> >
>> > Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.