![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
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 |
Ads |
#2
|
|||
|
|||
![]()
Use the Application.ActiveInspectort.WordEditor method to return a
Word.Document object from the currently open message. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "RPMitchal" wrote in message ... 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 |
#3
|
|||
|
|||
![]() 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: 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 |
#4
|
|||
|
|||
![]()
Michael and Sue:
Thank you both very much. I can't tell you how much I appreciate all that you "Gurus" do. :-) Rod "Sue Mosher [MVP]" wrote: Use the Application.ActiveInspectort.WordEditor method to return a Word.Document object from the currently open message. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "RPMitchal" wrote in message ... 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 . |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
VBA help window: Multiple windows/tabs, bookmarks, bookmarks/historypane | [email protected] | Outlook and VBA | 4 | May 19th 09 02:09 PM |
Open Appointment form from User Form code and add the attemdee ite | masani paresh[_2_] | Outlook - Using Forms | 2 | February 11th 09 11:59 AM |
Outlook Hyperlinks with Bookmarks | [email protected] | Outlook - General Queries | 1 | September 25th 06 09:35 PM |
How do I tell when a user has cancelled changes on an Outlook form? | Anne | Outlook and VBA | 1 | May 18th 06 12:09 PM |
Favourites/bookmarks | Percy | Outlook Express | 4 | February 26th 06 02:24 PM |