Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MailMerge Help

Status
Not open for further replies.

chachi64

MIS
Apr 15, 2009
1
US
Trying to automate the mail merge function to get values from an excel document into a word document, I've googled quite a bit, but can't seem to find the last two pieces of the puzzle. One the script is prompting me to select the table (there's only one sheet in the workbook) and two, how do I get word to wait until printing is complete before closing. The code I have so far is below

Set objWord = CreateObject("Word.Application")
objword.Documents.Open("c:\mail merge test\Test.doc")
objword.ActiveDocument.MailMerge.OpenDataSource("c:\mail merge test\Test.xls")
objword.ActiveDocument.MailMerge.Execute()
objword.ActiveDocument.PrintOut
'I sleep so that the documents will print
WScript.Sleep 10000
objword.Quit(0)

Any help would be greatly appreciated.
 
objword.ActiveDocument.PrintOut[!], False[/!]

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top