Code in document to place bookmarked data in Outlook subject line

A

A_Classic_Man

I have a Word document that has bookmark fields. I would like data
from some of the bookmarks to show in the subject line when I email
the document. We are using Office 97. Can this be done with code in
the Word document or is it done in Outlook?

Thanks in advance
Ron
 
D

Doug Robbins - Word MVP

It can be done with code in Word once you have a reference in the Visual
Basic Editor to the appropriate Outlook Object Model.

See the article "How to send an email from Word using VBA" at:

http://www.word.mvps.org/FAQs/InterDev/SendMail.htm

in the code in the second method in that article, you would replace the line

.Subject = "New subject"

with

.Subject = "sometext" &
ActiveDocument.Bookmarks("nameofbookmarktobeinsertedinsubject").Range.Text &
"somemoretextifnecessary"



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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