Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Code for Printing Hidden Sheets

Hi,

I have a project that includes one main sheet used to
collect necessary data and then a number of other sheets
that calculate and display the data in reports.

I would like to keep all of the report sheets hidden and
then be able to print from the main sheet by clicking a
command button relating to the sheet.

I've tried

Sub Print ()
Sheets("Report_To_Print").PrintOut Copies:=1,
Collate:=True
End Sub

However I get a compile error.

Is it possible to print a hidden sheet without making it
visible first? Can anybody offer a solution?

Thanks for your help,
Todd
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Code for Printing Hidden Sheets

Todd,

You need to make the sheet visible first.

Application.ScreenUpdating = False
With Worksheets("Sheet1")
.Visible = xlSheetVisible
.PrintOut ' preview:=True
.Visible = xlSheetHidden
End With
Application.ScreenUpdating = True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Todd" wrote in message
...
Hi,

I have a project that includes one main sheet used to
collect necessary data and then a number of other sheets
that calculate and display the data in reports.

I would like to keep all of the report sheets hidden and
then be able to print from the main sheet by clicking a
command button relating to the sheet.

I've tried

Sub Print ()
Sheets("Report_To_Print").PrintOut Copies:=1,
Collate:=True
End Sub

However I get a compile error.

Is it possible to print a hidden sheet without making it
visible first? Can anybody offer a solution?

Thanks for your help,
Todd



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Code for Printing Hidden Sheets

Sub Print ()
Dim lvis as Long
Application.ScreenUpdating = False
With Sheets("Report_To_Print")
lVis = .visible
.Visible = True
.PrintOut Copies:=1, Collate:=True
.visible = lVis
End With
Application.ScreenUpdating = True
End Sub

Is a possibility

--
Regards,
Tom Ogilvy


"Todd" wrote in message
...
Hi,

I have a project that includes one main sheet used to
collect necessary data and then a number of other sheets
that calculate and display the data in reports.

I would like to keep all of the report sheets hidden and
then be able to print from the main sheet by clicking a
command button relating to the sheet.

I've tried

Sub Print ()
Sheets("Report_To_Print").PrintOut Copies:=1,
Collate:=True
End Sub

However I get a compile error.

Is it possible to print a hidden sheet without making it
visible first? Can anybody offer a solution?

Thanks for your help,
Todd



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
Again printing with hidden rows [email protected] Excel Worksheet Functions 4 February 5th 09 07:31 PM
Formula or Code to keep Hidden Rows Hidden Carol Excel Worksheet Functions 6 May 1st 07 11:45 PM
Printing hidden worksheets MarcoR Excel Discussion (Misc queries) 4 April 8th 06 09:41 PM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Worksheet Functions 6 March 29th 06 12:43 PM
Printing hidden comments Tammy Excel Discussion (Misc queries) 1 May 24th 05 02:16 AM


All times are GMT +1. The time now is 12:26 AM.

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"