R
ryguy7272
I’m starting a new post; I think my previous post was going off on a tangent
that was not really where I wanted to go.
Below is the code that was generated by recording a macro in word, while
searching for a specific Excel file (Contacts.xls), to do a basic Mail Merge.
Sub Macro2()
ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
ActiveDocument.MailMerge.OpenDataSource Name:= _
"J:\Contacts.xls", ConfirmConversions:=False, ReadOnly _
:=False, LinkToSource:=True, AddToRecentFiles:=False,
PasswordDocument:= _
"", PasswordTemplate:="", WritePasswordDocument:="", _
WritePasswordTemplate:="", Revert:=False, Format:=wdOpenFormatAuto, _
Connection:= _
"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data
Source=J:\Contacts.xls;Mode=Read;Extended Properties=""HDR=YES;IMEX=1;"";Jet
OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDBatabase
Password="""";Jet OLEDB:Engin" _
, SQLStatement:="SELECT * FROM `Contacts`", SQLStatement1:="",
SubType:= _
wdMergeSubTypeAccess
ActiveDocument.MailMerge.ViewMailMergeFieldCodes = wdToggle
End Sub
This works fine. I am now wondering if I can customize it a little by
adding a feature that prompts the user for an input, perhaps through a
UserForm, to find the client address that will be included on a specific form
letter. We have all clients listed in the Excel file and each is identified
by ID number. I can control which address is input through the Mail Merge
toolbar, by using the ‘Go to Record’. I just want to personalize it a little
more by adding a UserForm that pops up, prompts the user for a number, and
this loads into the ‘Go to Record’.
Can this be done?
Regards,
Ryan---
that was not really where I wanted to go.
Below is the code that was generated by recording a macro in word, while
searching for a specific Excel file (Contacts.xls), to do a basic Mail Merge.
Sub Macro2()
ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
ActiveDocument.MailMerge.OpenDataSource Name:= _
"J:\Contacts.xls", ConfirmConversions:=False, ReadOnly _
:=False, LinkToSource:=True, AddToRecentFiles:=False,
PasswordDocument:= _
"", PasswordTemplate:="", WritePasswordDocument:="", _
WritePasswordTemplate:="", Revert:=False, Format:=wdOpenFormatAuto, _
Connection:= _
"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data
Source=J:\Contacts.xls;Mode=Read;Extended Properties=""HDR=YES;IMEX=1;"";Jet
OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDBatabase
Password="""";Jet OLEDB:Engin" _
, SQLStatement:="SELECT * FROM `Contacts`", SQLStatement1:="",
SubType:= _
wdMergeSubTypeAccess
ActiveDocument.MailMerge.ViewMailMergeFieldCodes = wdToggle
End Sub
This works fine. I am now wondering if I can customize it a little by
adding a feature that prompts the user for an input, perhaps through a
UserForm, to find the client address that will be included on a specific form
letter. We have all clients listed in the Excel file and each is identified
by ID number. I can control which address is input through the Mail Merge
toolbar, by using the ‘Go to Record’. I just want to personalize it a little
more by adding a UserForm that pops up, prompts the user for a number, and
this loads into the ‘Go to Record’.
Can this be done?
Regards,
Ryan---