Merge Word problem

F

Focus

The folowing module opens 2 documents: the main merge document
(C:\MyMerge.doc) and the merged document
Thow i want to close only the C:\MyMerge.doc so user can not ruin it,
without the saving messege, while keeping open the merged document
have any idea?

Function MergeIt()
Dim objWord As Word.Document
Set objWord = GetObject("C:\MyMerge.doc", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as the Northwind database.
objWord.MailMerge.OpenDataSource _
Name:="C:\Program Files\Microsoft " & _
"Office\Office\Samples\Northwind.mdb", _
LinkToSource:=True, _
Connection:="TABLE Customers", _
SQLStatement:="SELECT * FROM [Customers]"
' Execute the mail merge.
objWord.MailMerge.Execute
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top