Printing all Visible sheets

D

Darin Kramer

Hi

I get an error message "Method 'PrintOut' of Object_'Worksheet' failed
when running the following Macro:

Sub PrintVisibleSheets_2()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Visible Then
If ws.Name <> "Grading_guid" Then
ws.PrintOut Copies:=1, Collate:=True
End If
End If
Next
End Sub

I have turned protectin on on some of the sheets.
One sheet is Very Hidden
Line that it highlights to debug is ws.Printout line

The Macro used to work before!!!

(i even tried to delete the IFws.name line (not essential not to print
that one) - so question is how can I print all visible sheets in a
workbook??

Thanks

D
 
B

Bob Phillips

VeryHidden sheets evaluate to True in

If ws.Visible Then

Try

if ws.Visible = xlSheetVisible Then

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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

Similar Threads


Top