Z Zenobia Registered User. Local time Today, 01:13 Joined Jan 28, 2011 Messages 35 Feb 9, 2011 #1 Hello, I wish to create a button on a form that will link to data in a table and create mail merge, or link to an existing mail merge document, what is the best way to do this? Thank you
Hello, I wish to create a button on a form that will link to data in a table and create mail merge, or link to an existing mail merge document, what is the best way to do this? Thank you
G GaryPanic Smoke me a Kipper,Skipper Local time Yesterday, 17:13 Joined Nov 8, 2005 Messages 3,309 Feb 9, 2011 #2 check out supereasy word merge - in the samples
Z Zenobia Registered User. Local time Today, 01:13 Joined Jan 28, 2011 Messages 35 Feb 12, 2011 #3 Great thank you. Is there anything else i need to do but insert this code Option Compare Database Dim WithEvents oApp As Word.Application Private Sub Command0_Click() Dim oMainDoc As Word.Document Dim oSel As Word.Selection Dim sDBPath As String Set oMainDoc = oApp.Documents.Open("c:\Test Letter") oApp.Visible = True With oMainDoc.MailMerge .MainDocumentType = wdFormLetters sDBPath = "C:\Letter Database.mdb" .OpenDataSource Name:=sDBPath, _ SQLStatement:="SELECT * FROM [tblcompanies]" End With With oMainDoc .MailMerge.Destination = wdSendToNewDocument .MailMerge.Execute End With oApp.Activate oApp.Documents.Parent.Visible = True oApp.Application.WindowState = 1 oApp.ActiveWindow.WindowState = 1 End Sub Private Sub Form_Load() Set oApp = CreateObject("Word.Application") End Sub Private Sub Form_Unload(Cancel As Integer) Set oApp = Nothing End Sub as not working for me just inserting this code... Any anyone shed any light on this for me please?
Great thank you. Is there anything else i need to do but insert this code Option Compare Database Dim WithEvents oApp As Word.Application Private Sub Command0_Click() Dim oMainDoc As Word.Document Dim oSel As Word.Selection Dim sDBPath As String Set oMainDoc = oApp.Documents.Open("c:\Test Letter") oApp.Visible = True With oMainDoc.MailMerge .MainDocumentType = wdFormLetters sDBPath = "C:\Letter Database.mdb" .OpenDataSource Name:=sDBPath, _ SQLStatement:="SELECT * FROM [tblcompanies]" End With With oMainDoc .MailMerge.Destination = wdSendToNewDocument .MailMerge.Execute End With oApp.Activate oApp.Documents.Parent.Visible = True oApp.Application.WindowState = 1 oApp.ActiveWindow.WindowState = 1 End Sub Private Sub Form_Load() Set oApp = CreateObject("Word.Application") End Sub Private Sub Form_Unload(Cancel As Integer) Set oApp = Nothing End Sub as not working for me just inserting this code... Any anyone shed any light on this for me please?