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

Using Bookmarks and User Form within Outlook



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old December 18th 09, 02:33 PM posted to microsoft.public.outlook.program_vba
RPMitchal
external usenet poster
 
Posts: 2
Default Using Bookmarks and User Form within Outlook

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  
Old December 18th 09, 02:59 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP][_4_]
external usenet poster
 
Posts: 552
Default Using Bookmarks and User Form within Outlook

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  
Old December 18th 09, 04:16 PM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Using Bookmarks and User Form within Outlook



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  
Old December 21st 09, 08:44 PM posted to microsoft.public.outlook.program_vba
RPMitchal
external usenet poster
 
Posts: 2
Default Using Bookmarks and User Form within Outlook

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
Search this Thread:

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


All times are GMT +1. The time now is 03:35 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright 2004-2025 Outlook Banter.
The comments are property of their posters.