ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel crashes after printing via VBA (https://www.excelbanter.com/excel-programming/412119-excel-crashes-after-printing-via-vba.html)

MIKE D

Excel crashes after printing via VBA
 
The code looks like this:

Sheets(Array("MEMO", "ODC ETC", "BURN RATE")).Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub

After returning from the sub above, the application proceeds with
programmatically manipulating the workbook. The first time through, it
prints correctly, but then Excel hangs, and then crashes.

I'm currently avoiding this by returning from the sub, and then throwing up
a Yes/No message box to effectively 'pause' the app before proceeding with
the code.

Suboptimal.

Is it possible to make VBA wait for the print job to be
printed/spooled/whatever before proceeding with code?

Thanks In Advance - Mike D.
--
- MJD

IanC[_2_]

Excel crashes after printing via VBA
 
This line pauses for 3 seconds before calling a subroutine.

Application.OnTime earliesttime:=Now + TimeSerial(0, 0, 3),
procedu="UnhideColumns"

It doesn't actually wait for a process to complete, just for a fixed time.

--
Ian
--
"Mike D" wrote in message
...
The code looks like this:

Sheets(Array("MEMO", "ODC ETC", "BURN RATE")).Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub

After returning from the sub above, the application proceeds with
programmatically manipulating the workbook. The first time through, it
prints correctly, but then Excel hangs, and then crashes.

I'm currently avoiding this by returning from the sub, and then throwing
up
a Yes/No message box to effectively 'pause' the app before proceeding with
the code.

Suboptimal.

Is it possible to make VBA wait for the print job to be
printed/spooled/whatever before proceeding with code?

Thanks In Advance - Mike D.
--
- MJD





All times are GMT +1. The time now is 03:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com