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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA code for Print and Quit

Status
Not open for further replies.

ChrisRChamberlain

Programmer
Mar 23, 2000
3,392
GB
Hi

The following code is from Visual Foxpro where the requirement is to instantiate Word as a COM object, print a file and immediately close the instance of Word.

lcFileName = ALLT(CURRPROJ.filename)
oWord = CreateObject([Word.Application])
oDocument = oWord.Documents.Open(lcFileName)
oDocument.Printout()

oWord.Quit()

As the current program is quitting before the print process is complete, a dialog appears questioning whether Word is to be terminated.

What VBA code is required to force Word to complete the print operation and then close itself down?

TIA

Chris :)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top