Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mail merge in MS Word (VB)

Status
Not open for further replies.

burr

Programmer
Jul 17, 2000
29
US
I created Macro1 for a label mail merge. I find by looking at the VB code, the label info ( name, address, City,st,zip) is probably located in the AutoText:="ToolsCreateLabels1". See the example below. If I RUN this Sub directly, it generates the page of labels as it should. If I paste it into another macro and rename it to a Function, I can call it from macro #2 and it works ok.

If I delete Macro1, then macro2 cant find the address fields. It seems that Macro2 is still looking at Macro1 for the address fields. How can I carry the Address fields for the label into the Macro2? Better yet, where is the AutoText defined and where is "ToolsCreateLabels1" stored.

Thanks
Burr Stephens
Anderson IN


Sub Macro1()
'
' Macro1 Macro
' Macro recorded 10/25/01 by Burr Stephens
'
ActiveDocument.MailMerge.MainDocumentType = wdMailingLabels
ActiveDocument.MailMerge.OpenDataSource Name:= _
"C:\Program_Source_Files\St Matthew Membership.mdb", ConfirmConversions:= _
False, ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="", WritePasswordDocument:="", _
WritePasswordTemplate:="", Revert:=False, Format:=wdOpenFormatAuto, _
Connection:="TABLE MiscMergeMail", SQLStatement:= _
"SELECT * FROM [MiscMergeMail]", SQLStatement1:=""
Application.MailingLabel.DefaultPrintBarCode = False
Application.MailingLabel.CreateNewDocument Name:="", Address:="", AutoText _
:="ToolsCreateLabels1"
End Sub


Burr Stephens
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top