I have two questions. Here is my code for making mailing labels
Function MergeIt()
Dim MailOutDoc As Word.Document
Set MailOutDoc = GetObject("J:\Office.sys\AHLS_Database\AHLS_Database_Mailing_Labels.doc", "Word.Document"
MailOutDoc.Application.Visible = True
MailOutDoc.MailMerge.OpenDataSource _
Name:="J:\Office.sys\AHLS_Database\AHLS_Database.mdb", _
LinkToSource:=True, _
Connection:="QUERY Mail List Customer Contact Query", _
SQLStatement:="Select * from [Mail List Customer Contact Query]"
MailOutDoc.MailMerge.Destination = wdSendToNewDocument
MailOutDoc.MailMerge.Execute
MailOutDoc.Application.Options.PrintBackground = False
MailOutDoc.Application.ActiveDocument.PrintOut
End Function
However, when I click on the button in access that executes this function, my word doc opens, a new word doc opens and two more databases open. I don't really understand the coding well, so if someone could help...
I just want the one word doc w/ the mailing labels to open (it can be a new doc).
Secondly, if someone already has a letter they have written up and wants to use the db to merge with their letter, how could this be done? It obviously must be specific to their document name.
Thanks in advance
Function MergeIt()
Dim MailOutDoc As Word.Document
Set MailOutDoc = GetObject("J:\Office.sys\AHLS_Database\AHLS_Database_Mailing_Labels.doc", "Word.Document"
MailOutDoc.Application.Visible = True
MailOutDoc.MailMerge.OpenDataSource _
Name:="J:\Office.sys\AHLS_Database\AHLS_Database.mdb", _
LinkToSource:=True, _
Connection:="QUERY Mail List Customer Contact Query", _
SQLStatement:="Select * from [Mail List Customer Contact Query]"
MailOutDoc.MailMerge.Destination = wdSendToNewDocument
MailOutDoc.MailMerge.Execute
MailOutDoc.Application.Options.PrintBackground = False
MailOutDoc.Application.ActiveDocument.PrintOut
End Function
However, when I click on the button in access that executes this function, my word doc opens, a new word doc opens and two more databases open. I don't really understand the coding well, so if someone could help...
I just want the one word doc w/ the mailing labels to open (it can be a new doc).
Secondly, if someone already has a letter they have written up and wants to use the db to merge with their letter, how could this be done? It obviously must be specific to their document name.
Thanks in advance