PDA

View Full Version : Outlook Bookmark



msadiqrajani
10-04-2010, 09:10 AM
Hello..

I have created a message template in which are several bookmarks.

Now i want to goto each bookmark through VBA and enter some text.
In word it could have been done using selection.goto command..and then
selection.typetext ....

But it's not working in outlook message window.

Any idea how to goto bookmark and enter text
my message(mail item) variable name is msg
Thanks

Charlize
10-13-2010, 02:54 AM
To get you started :
Sub goto_bookmark()
'declare two variables to use to loop through bookmarks
'of the active mail you are composing
Dim themessage As Object, thebookmark As Object
'return a word object that can handle bookmarks
Set themessage = Application.ActiveInspector.WordEditor
'loop through each bookmark and fill it in on the fly
For Each thebookmark In themessage.Bookmarks
'this uses the name of the bookmark to display a dialogbox so
'you could fill out your placeholders
'info is put before the bookmark
themessage.Bookmarks(thebookmark.Name).Range.InsertBefore InputBox(thebookmark.Name & " ?")
Next thebookmark
End SubCharlize

jasoncw
06-01-2011, 09:08 AM
I have been trying to figure out how to edit and format the active email body in Outlook for quite a while now. I just wanted to say thanks Charlize for your above reply!

Jason