Merge Word problem

  • Thread starter Thread starter Focus
  • Start date Start date
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
 
Back
Top