A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Tags: , , , ,

Insert word document/Bookmark into email body





 
 
Thread Tools Display Modes
  #1  
Old September 15th 06, 04:50 PM posted to microsoft.public.outlook.program_vba
paul
external usenet poster
 
Posts: 142
Default Insert word document/Bookmark into email body

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


Ads
  #2  
Old September 18th 06, 07:36 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,264
Default Insert word document/Bookmark into email body

Am Fri, 15 Sep 2006 07:50:02 -0700 schrieb Paul:

Try this:

mItem.Body= bmark & vbCRLF & mItem.Body

--
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.
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

  #3  
Old September 18th 06, 12:05 PM posted to microsoft.public.outlook.program_vba
paul
external usenet poster
 
Posts: 142
Default Insert word document/Bookmark into email body

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

"Michael Bauer [MVP - Outlook]" wrote:

Am Fri, 15 Sep 2006 07:50:02 -0700 schrieb Paul:

Try this:

mItem.Body= bmark & vbCRLF & mItem.Body

--
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.
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


  #4  
Old September 18th 06, 01:10 PM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,264
Default Insert word document/Bookmark into email body

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.

--
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"

what I am really trying to do is instantiate an outlook template and to

add
the user's default signature

"Michael Bauer [MVP - Outlook]" wrote:

Am Fri, 15 Sep 2006 07:50:02 -0700 schrieb Paul:

Try this:

mItem.Body= bmark & vbCRLF & mItem.Body

--
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.
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


  #5  
Old September 22nd 06, 02:45 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Insert word document/Bookmark into email body

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.

--
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

"Paul" wrote in message ...
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

"Michael Bauer [MVP - Outlook]" wrote:

Am Fri, 15 Sep 2006 07:50:02 -0700 schrieb Paul:

Try this:

mItem.Body= bmark & vbCRLF & mItem.Body

--
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.
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


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
word document from contact files so it looks like a directory lomar Outlook - Using Contacts 1 July 29th 06 11:26 PM
insert as text (to insert html into email body) Iona Outlook - General Queries 1 July 13th 06 01:10 PM
Creating appointment from a word document emferrari@gmail.com Outlook and VBA 3 June 9th 06 06:56 AM
Extracting Distribution list to Word document toby.briggs@gmail.com Outlook - General Queries 2 April 19th 06 01:26 PM
How do I convert Outlook calendar into a Word document? Jeana Outlook - Calandaring 2 March 7th 06 05:03 PM


All times are GMT +1. The time now is 03:20 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright Đ2004-2008 Outlook Banter, part of the NewsgroupBanter project.
The comments are property of their posters.
Mortgage Calculator - Web Based RSS Reader - Credit Card - Best Credit Cards - Online Advertising