Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm using Excel 2000 & windows nt 4, sp6.
I'm using Excel to extract label info to a 'prn' file, then opening a Word doc & merging 'prn' info, then printing the merged document. Works great - except that when I attempt to close the word object, I get a message that Word is printing & closing will stop the printing. Don't want that to happen, but I also want to close Word from within Excel. My question is: Is there a way to execute a loop to determine when the print job has finished? Where do I put the loop? Or this a needless worry? Thanks - mike Code: Dim wordApp As Object Set wordApp = CreateObject("Word.Application") With wordApp .Documents.Open Filename:="1.doc", _ (formatting code) .Application.PrintOut Filename:="1.doc", _ .activeDocument.Close End With wordApp.Quit |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Mike,
Put in a delay of 10 seconds to allow printing to finish before closing the doc. (You may find 5 seconds is long enough. Experiment!) Application.Wait Time + TimeValue("00:00:10") HTH Henry "Mike Molyneaux" wrote in message ... I'm using Excel 2000 & windows nt 4, sp6. I'm using Excel to extract label info to a 'prn' file, then opening a Word doc & merging 'prn' info, then printing the merged document. Works great - except that when I attempt to close the word object, I get a message that Word is printing & closing will stop the printing. Don't want that to happen, but I also want to close Word from within Excel. My question is: Is there a way to execute a loop to determine when the print job has finished? Where do I put the loop? Or this a needless worry? Thanks - mike Code: Dim wordApp As Object Set wordApp = CreateObject("Word.Application") With wordApp .Documents.Open Filename:="1.doc", _ (formatting code) .Application.PrintOut Filename:="1.doc", _ .activeDocument.Close End With wordApp.Quit |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This might not be an option for you, but I've turned off background printing in
MSWord. Tools|Options|Print Tab|Uncheck background printing. (I did it manually, but maybe you could have your macro do it (and reset it back when you're done).) Mike Molyneaux wrote: I'm using Excel 2000 & windows nt 4, sp6. I'm using Excel to extract label info to a 'prn' file, then opening a Word doc & merging 'prn' info, then printing the merged document. Works great - except that when I attempt to close the word object, I get a message that Word is printing & closing will stop the printing. Don't want that to happen, but I also want to close Word from within Excel. My question is: Is there a way to execute a loop to determine when the print job has finished? Where do I put the loop? Or this a needless worry? Thanks - mike Code: Dim wordApp As Object Set wordApp = CreateObject("Word.Application") With wordApp .Documents.Open Filename:="1.doc", _ (formatting code) .Application.PrintOut Filename:="1.doc", _ .activeDocument.Close End With wordApp.Quit -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
sendkeys(keys,wait) how do I use wait | Excel Discussion (Misc queries) | |||
Re-show userform after closing file - code help | Excel Discussion (Misc queries) | |||
How to code on Macro on saving and closing a file? | Excel Worksheet Functions | |||
Resume.xlw and closing workbook with VBA code. | Excel Discussion (Misc queries) | |||
Closing the VBA Editor using code | Excel Worksheet Functions |