PDA

View Full Version : Solved: Print Multiple Worksheets Error



jmenche
09-20-2007, 11:45 AM
Folks,

Here's some code that I have to print multiple worksheets.

Sub PrintScenario()
sheets(Array("# Of Items", "PV Allocation", "Premium", "Value", "Summary")).Select
sheets("Summary").Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=True, Collate:= _
True
End Sub

My problem is that these sheets have protection and Worksheet_Activate routines that generate error messages when I run the code. However, this is the code that I recorded when I selected the sheets and hit the Print button! Can someone tell me what's the difference and what a possible workaround is. Maybe a SendKey to Print??

Thanks for your help. :beerchug:

mdmackillop
09-20-2007, 11:59 AM
Sheets(Array("Sheet1", "Sheet2", "Sheet3")).PrintOut

jmenche
09-20-2007, 12:06 PM
md,

I keep getting the same error. It keeps trying to activate each sheet and I get an application error because it can't run the worksheet_activate event because the sheets are grouped.

mdmackillop
09-20-2007, 12:17 PM
How about
Sub Macro1()
Application.EnableEvents = False
Sheets(Array("Sheet1", "Sheet2", "Sheet3")).PrintOut
Application.EnableEvents = True
End Sub

jmenche
09-20-2007, 12:27 PM
That's the ticket! I guess that stuff doesn't get recorded.

:friends: