View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Printing all Visible sheets

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)


"Darin Kramer" wrote in message
...
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

*** Sent via Developersdex http://www.developersdex.com ***