Excel crashes after printing via VBA

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.
 
I

IanC

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top