Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 397
Default Printing all Visible sheets

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 ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
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 ***



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 397
Default Printing all Visible sheets


Brilliant!! It works Thanks


*** Sent via Developersdex http://www.developersdex.com ***
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing only Rows with Visible Data Storm Excel Discussion (Misc queries) 7 December 8th 05 09:19 PM
visible sheets Bombermanx Excel Programming 3 November 12th 04 02:03 PM
HELP!! Cannot set any sheets to visible cassidyr1[_4_] Excel Programming 1 October 27th 04 02:19 PM
HELP!! Cannot set any sheets to visible cassidyr1[_3_] Excel Programming 1 October 26th 04 06:36 PM
select visible cells when printing Richard Leclezio Excel Programming 0 October 1st 03 10:22 AM


All times are GMT +1. The time now is 07:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"