Using Bookmarks and User Form within Outlook

  • Thread starter Thread starter RPMitchal
  • Start date Start date
R

RPMitchal

Outlook 2007

Hello Gurus:

I am attempting to put together what I’m sure is a rather simple macro
within Outlook for an e-mail transmission.

I am using bookmarks (for now using default names) whereby I fill in the
appropriate blanks within the “User Form†in the hopes that the information
from the User Form will be used to populate the applicable bookmarks within
the Template.

The process seems to work flawlessly within Word. However, in using
Outlook, I receive an error: Compile Error: Variable not defined which
applies to the underlined coding below *With ActiveDocument*.

Any assistance in this regard will be greatly appreciated.

Thanks - Rod

Option Explicit

Private Sub CommandButton1_Click()
With ActiveDocument
.Bookmarks("Text1").Range.InsertBefore TextBox1
.Bookmarks("Text2").Range.InsertBefore TextBox2
.Bookmarks("Text3").Range.InsertBefore TextBox3
End With

UserForm1.Hide

End Sub
 
Use the Application.ActiveInspectort.WordEditor method to return a
Word.Document object from the currently open message.
 
Outlook doesn't now ActiveDocument, which belongs to the Word library. In
Outlook 2007, Application.ActiveInspector.Wordeditor returns a Word.Document
object.

--
Best regards
Michael Bauer - MVP Outlook
Manage and share your categories:
<http://www.vboffice.net/product.html?pub=6&lang=en>


Am Fri, 18 Dec 2009 06:33:01 -0800 schrieb RPMitchal:
 
Michael and Sue:

Thank you both very much. I can't tell you how much I appreciate all that
you "Gurus" do. :-)

Rod
 
Back
Top