Suggestions need for best way to Mail Merge (1 Viewer)

Zenobia

Registered User.
Local time
Today, 01:15
Joined
Jan 28, 2011
Messages
35
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
 

GaryPanic

Smoke me a Kipper,Skipper
Local time
Yesterday, 17:15
Joined
Nov 8, 2005
Messages
3,294
check out supereasy word merge - in the samples
 

Zenobia

Registered User.
Local time
Today, 01:15
Joined
Jan 28, 2011
Messages
35
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?
 

Users who are viewing this thread

Top Bottom