Excel crashes after printing via VBA

  • Thread starter Thread starter Mike D
  • Start date Start date
M

Mike D

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.
 
This line pauses for 3 seconds before calling a subroutine.

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

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