Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Printing hidden worksheets?

Background: I have a workbook that has about 100 hidden sheets at any one
time, two of which are data sheets named Data1 and Data2 that all other
sheets pull their data from. Basically selection options on the default
visible page make specific sheets visible. Each time a sheet is made visible,
the previous sheet is made invisible.

I want to add a sub routine that will print all the sheets in landscape
format, both visible AND invisible, excluding the two data sheets. I don't
want them to print at all.
I also would prefer the invisible sheets do not become visible again for the
printjob.

Thanks folks - Michelle


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Printing hidden worksheets?

You must unhide them to print
Try this example (untested)

Sub test()
Dim curVis As Long
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
If sh.Name < "Data1" And sh.Name < "Data2" Then
With sh
curVis = .Visible
.Visible = xlSheetVisible
.PrintOut
.Visible = curVis
End With
End If
Next sh
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl



"MichelleDuquette" wrote in message
...
Background: I have a workbook that has about 100 hidden sheets at any one
time, two of which are data sheets named Data1 and Data2 that all other
sheets pull their data from. Basically selection options on the default
visible page make specific sheets visible. Each time a sheet is made visible,
the previous sheet is made invisible.

I want to add a sub routine that will print all the sheets in landscape
format, both visible AND invisible, excluding the two data sheets. I don't
want them to print at all.
I also would prefer the invisible sheets do not become visible again for the
printjob.

Thanks folks - Michelle




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default Printing hidden worksheets?

You could hide all tabs
ActiveWindow.DisplayWorkbookTabs = False
Then by controlbutton control specific sheets for that user thereby all
sheets are unavailable for selection and therefore viewing.

--
Jim at Eagle


"Ron de Bruin" wrote:

You must unhide them to print
Try this example (untested)

Sub test()
Dim curVis As Long
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
If sh.Name < "Data1" And sh.Name < "Data2" Then
With sh
curVis = .Visible
.Visible = xlSheetVisible
.PrintOut
.Visible = curVis
End With
End If
Next sh
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl



"MichelleDuquette" wrote in message
...
Background: I have a workbook that has about 100 hidden sheets at any one
time, two of which are data sheets named Data1 and Data2 that all other
sheets pull their data from. Basically selection options on the default
visible page make specific sheets visible. Each time a sheet is made visible,
the previous sheet is made invisible.

I want to add a sub routine that will print all the sheets in landscape
format, both visible AND invisible, excluding the two data sheets. I don't
want them to print at all.
I also would prefer the invisible sheets do not become visible again for the
printjob.

Thanks folks - Michelle





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Printing hidden worksheets?

Thanks Ron! Your code worked just fine..
Here's what I'm using. Can this be modified to print all selected worksheets
as one job? (I've seen the "copy" method, but it's a little too late for that
with so many sheets..) Thanks again! -Michelle
Private Sub PrintWBCommandButton_Click()
Dim curVis As Long
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
If sh.Name < "Data1" And sh.Name < "Data2" Then
With sh
.Application.ScreenUpdating = False
.PageSetup.Orientation = xlLandscape
.PageSetup.FitToPagesWide = 1
.PageSetup.FitToPagesTall = 1
curVis = .Visible
.Visible = xlSheetVisible
.PrintPreview
.Visible = curVis
.Application.ScreenUpdating = True
End With
End If
Next sh
End Sub

"Ron de Bruin" wrote:

You must unhide them to print
Try this example (untested)

Sub test()
Dim curVis As Long
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
If sh.Name < "Data1" And sh.Name < "Data2" Then
With sh
curVis = .Visible
.Visible = xlSheetVisible
.PrintOut
.Visible = curVis
End With
End If
Next sh
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl



"MichelleDuquette" wrote in message
...
Background: I have a workbook that has about 100 hidden sheets at any one
time, two of which are data sheets named Data1 and Data2 that all other
sheets pull their data from. Basically selection options on the default
visible page make specific sheets visible. Each time a sheet is made visible,
the previous sheet is made invisible.

I want to add a sub routine that will print all the sheets in landscape
format, both visible AND invisible, excluding the two data sheets. I don't
want them to print at all.
I also would prefer the invisible sheets do not become visible again for the
printjob.

Thanks folks - Michelle





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Printing hidden worksheets?

If you want to print all selected worksheets then use this
(you can't select hidden sheets)

ActiveWindow.SelectedSheets.PrintOut



--
Regards Ron de Bruin
http://www.rondebruin.nl



"MIchelleDuquette" wrote in message
...
Thanks Ron! Your code worked just fine..
Here's what I'm using. Can this be modified to print all selected worksheets
as one job? (I've seen the "copy" method, but it's a little too late for that
with so many sheets..) Thanks again! -Michelle
Private Sub PrintWBCommandButton_Click()
Dim curVis As Long
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
If sh.Name < "Data1" And sh.Name < "Data2" Then
With sh
.Application.ScreenUpdating = False
.PageSetup.Orientation = xlLandscape
.PageSetup.FitToPagesWide = 1
.PageSetup.FitToPagesTall = 1
curVis = .Visible
.Visible = xlSheetVisible
.PrintPreview
.Visible = curVis
.Application.ScreenUpdating = True
End With
End If
Next sh
End Sub

"Ron de Bruin" wrote:

You must unhide them to print
Try this example (untested)

Sub test()
Dim curVis As Long
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
If sh.Name < "Data1" And sh.Name < "Data2" Then
With sh
curVis = .Visible
.Visible = xlSheetVisible
.PrintOut
.Visible = curVis
End With
End If
Next sh
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl



"MichelleDuquette" wrote in message
...
Background: I have a workbook that has about 100 hidden sheets at any one
time, two of which are data sheets named Data1 and Data2 that all other
sheets pull their data from. Basically selection options on the default
visible page make specific sheets visible. Each time a sheet is made visible,
the previous sheet is made invisible.

I want to add a sub routine that will print all the sheets in landscape
format, both visible AND invisible, excluding the two data sheets. I don't
want them to print at all.
I also would prefer the invisible sheets do not become visible again for the
printjob.

Thanks folks - Michelle







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 a hidden image SteveK14 Excel Discussion (Misc queries) 1 January 10th 09 08:11 PM
Printing hidden rows New2XL Excel Discussion (Misc queries) 0 January 30th 07 01:13 PM
How do I detect hidden worksheets or hidden data on a worksheet? Alice Excel Discussion (Misc queries) 4 August 24th 06 03:38 AM
Printing Hidden Rows susubee Excel Discussion (Misc queries) 4 May 5th 06 08:26 PM
Printing hidden worksheets MarcoR Excel Discussion (Misc queries) 4 April 8th 06 09:41 PM


All times are GMT +1. The time now is 10:27 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"