Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default Macro to print a hidden sheet

I was give the following to make a button to print a sheet. But how do i
make this macro to print a hidden sheet?
I really do appreciate everyone's help
GlennHi Glenn
---------------------------------------------------------------------------
Identify the specific sheet you want to print in the code.....

Sub PrintSpecificSheet()
ActiveWorkbook.Sheets("Sheet2").PrintOut
End Sub
--

-----
XL2003
Regards

William




"Glenn" wrote in message
...
I am a novice learning....
I would like to know how I can write a macro that would make a particular
worksheet print. I would like to press a button on one sheet and make
another sheet print.
Thanks for your help,
Glenn



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Macro to print a hidden sheet

In your code you can unhide the object (worksheet) and then print it. Then
hide it again. If you wish for it to be transparent to the user set the
application.screenupdating = false at the beginning and then = true at the
end.

"Glenn" wrote:

I was give the following to make a button to print a sheet. But how do i
make this macro to print a hidden sheet?
I really do appreciate everyone's help
GlennHi Glenn
---------------------------------------------------------------------------
Identify the specific sheet you want to print in the code.....

Sub PrintSpecificSheet()
ActiveWorkbook.Sheets("Sheet2").PrintOut
End Sub
--

-----
XL2003
Regards

William




"Glenn" wrote in message
...
I am a novice learning....
I would like to know how I can write a macro that would make a particular
worksheet print. I would like to press a button on one sheet and make
another sheet print.
Thanks for your help,
Glenn



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Macro to print a hidden sheet

Hi Glenn

Sub test()
Dim curVis As Long
Dim sh As Worksheet
Set sh = ActiveWorkbook.Sheets("sheet2")
With sh
curVis = .Visible
.Visible = xlSheetVisible
.PrintPreview
.Visible = curVis
End With
End Sub

see also
http://www.rondebruin.nl/print.htm#visible


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



"Glenn" wrote in message ...
I was give the following to make a button to print a sheet. But how do i
make this macro to print a hidden sheet?
I really do appreciate everyone's help
GlennHi Glenn
---------------------------------------------------------------------------
Identify the specific sheet you want to print in the code.....

Sub PrintSpecificSheet()
ActiveWorkbook.Sheets("Sheet2").PrintOut
End Sub
--

-----
XL2003
Regards

William




"Glenn" wrote in message
...
I am a novice learning....
I would like to know how I can write a macro that would make a particular
worksheet print. I would like to press a button on one sheet and make
another sheet print.
Thanks for your help,
Glenn





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Macro to print a hidden sheet

Hi Hi Glenn

Change PrintPreview to Printout



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



"Ron de Bruin" wrote in message ...
Hi Glenn

Sub test()
Dim curVis As Long
Dim sh As Worksheet
Set sh = ActiveWorkbook.Sheets("sheet2")
With sh
curVis = .Visible
.Visible = xlSheetVisible
.PrintPreview
.Visible = curVis
End With
End Sub

see also
http://www.rondebruin.nl/print.htm#visible


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



"Glenn" wrote in message ...
I was give the following to make a button to print a sheet. But how do i
make this macro to print a hidden sheet?
I really do appreciate everyone's help
GlennHi Glenn
---------------------------------------------------------------------------
Identify the specific sheet you want to print in the code.....

Sub PrintSpecificSheet()
ActiveWorkbook.Sheets("Sheet2").PrintOut
End Sub
--

-----
XL2003
Regards

William




"Glenn" wrote in message
...
I am a novice learning....
I would like to know how I can write a macro that would make a particular
worksheet print. I would like to press a button on one sheet and make
another sheet print.
Thanks for your help,
Glenn







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Macro to print a hidden sheet

try this...

Sub PrintSpecificSheet()
Dim wks As Worksheet

Set wks = ActiveWorkbook.Sheets("Sheet2")
If wks.Visible < xlSheetVisible Then
Application.ScreenUpdating = False
wks.Visible = xlSheetVisible
wks.PrintOut
wks.Visible = xlSheetHidden
Application.ScreenUpdating = True
Else
wks.PrintOut
End If
Set wks = Nothing
End Sub

The only side effect to the code is that if the sheet was previously set as
xlVeryHidden (which can only be set in code so it probably does not apply)
then after the procedure is run it will only be xlHidden. There is a 99.9%
chance that you really don't need to wory about this.

HTH

"Glenn" wrote:

I was give the following to make a button to print a sheet. But how do i
make this macro to print a hidden sheet?
I really do appreciate everyone's help
GlennHi Glenn
---------------------------------------------------------------------------
Identify the specific sheet you want to print in the code.....

Sub PrintSpecificSheet()
ActiveWorkbook.Sheets("Sheet2").PrintOut
End Sub
--

-----
XL2003
Regards

William




"Glenn" wrote in message
...
I am a novice learning....
I would like to know how I can write a macro that would make a particular
worksheet print. I would like to press a button on one sheet and make
another sheet print.
Thanks for your help,
Glenn





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Macro to print a hidden sheet

Dim szSheet
With ActiveWorkbook.Worksheets("Sheet2")
szSheet = .Visible
.Visible = xlSheetVisible
.PrintPreview
.Visible = szSheet
End With


--

HTH

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


"Glenn" wrote in message
...
I was give the following to make a button to print a sheet. But how do i
make this macro to print a hidden sheet?
I really do appreciate everyone's help
GlennHi Glenn
--------------------------------------------------------------------------

-
Identify the specific sheet you want to print in the code.....

Sub PrintSpecificSheet()
ActiveWorkbook.Sheets("Sheet2").PrintOut
End Sub
--

-----
XL2003
Regards

William




"Glenn" wrote in message
...
I am a novice learning....
I would like to know how I can write a macro that would make a

particular
worksheet print. I would like to press a button on one sheet and make
another sheet print.
Thanks for your help,
Glenn





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Macro to print a hidden sheet

Hi Jim

xlVeryHidden (which can only be set in code so it probably does not apply)


You can do it manual in the VBA editor
Alt-F11
Select the sheet
Press F4
Change visible in the properties

See my code example also

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



"Jim Thomlinson" wrote in message
...
try this...

Sub PrintSpecificSheet()
Dim wks As Worksheet

Set wks = ActiveWorkbook.Sheets("Sheet2")
If wks.Visible < xlSheetVisible Then
Application.ScreenUpdating = False
wks.Visible = xlSheetVisible
wks.PrintOut
wks.Visible = xlSheetHidden
Application.ScreenUpdating = True
Else
wks.PrintOut
End If
Set wks = Nothing
End Sub

The only side effect to the code is that if the sheet was previously set as
xlVeryHidden (which can only be set in code so it probably does not apply)
then after the procedure is run it will only be xlHidden. There is a 99.9%
chance that you really don't need to wory about this.

HTH

"Glenn" wrote:

I was give the following to make a button to print a sheet. But how do i
make this macro to print a hidden sheet?
I really do appreciate everyone's help
GlennHi Glenn
---------------------------------------------------------------------------
Identify the specific sheet you want to print in the code.....

Sub PrintSpecificSheet()
ActiveWorkbook.Sheets("Sheet2").PrintOut
End Sub
--

-----
XL2003
Regards

William




"Glenn" wrote in message
...
I am a novice learning....
I would like to know how I can write a macro that would make a particular
worksheet print. I would like to press a button on one sheet and make
another sheet print.
Thanks for your help,
Glenn





  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Macro to print a hidden sheet

made exactly the same error :-). Shows we tested it!

Bob


"Ron de Bruin" wrote in message
...
Hi Hi Glenn

Change PrintPreview to Printout



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



"Ron de Bruin" wrote in message

...
Hi Glenn

Sub test()
Dim curVis As Long
Dim sh As Worksheet
Set sh = ActiveWorkbook.Sheets("sheet2")
With sh
curVis = .Visible
.Visible = xlSheetVisible
.PrintPreview
.Visible = curVis
End With
End Sub

see also
http://www.rondebruin.nl/print.htm#visible


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



"Glenn" wrote in message

...
I was give the following to make a button to print a sheet. But how do

i
make this macro to print a hidden sheet?
I really do appreciate everyone's help
GlennHi Glenn


-------------------------------------------------------------------------

--
Identify the specific sheet you want to print in the code.....

Sub PrintSpecificSheet()
ActiveWorkbook.Sheets("Sheet2").PrintOut
End Sub
--

-----
XL2003
Regards

William




"Glenn" wrote in message
...
I am a novice learning....
I would like to know how I can write a macro that would make a

particular
worksheet print. I would like to press a button on one sheet and make
another sheet print.
Thanks for your help,
Glenn








  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Macro to print a hidden sheet

made exactly the same error :-). Shows we tested it!

We love trees Bob <g


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



"Bob Phillips" wrote in message ...
made exactly the same error :-). Shows we tested it!

Bob


"Ron de Bruin" wrote in message
...
Hi Hi Glenn

Change PrintPreview to Printout



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



"Ron de Bruin" wrote in message

...
Hi Glenn

Sub test()
Dim curVis As Long
Dim sh As Worksheet
Set sh = ActiveWorkbook.Sheets("sheet2")
With sh
curVis = .Visible
.Visible = xlSheetVisible
.PrintPreview
.Visible = curVis
End With
End Sub

see also
http://www.rondebruin.nl/print.htm#visible


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



"Glenn" wrote in message

...
I was give the following to make a button to print a sheet. But how do

i
make this macro to print a hidden sheet?
I really do appreciate everyone's help
GlennHi Glenn


-------------------------------------------------------------------------

--
Identify the specific sheet you want to print in the code.....

Sub PrintSpecificSheet()
ActiveWorkbook.Sheets("Sheet2").PrintOut
End Sub
--

-----
XL2003
Regards

William




"Glenn" wrote in message
...
I am a novice learning....
I would like to know how I can write a macro that would make a

particular
worksheet print. I would like to press a button on one sheet and make
another sheet print.
Thanks for your help,
Glenn










  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Macro to print a hidden sheet

Yeah I know but the gist of what I was getting at is that the end user can
not manipulate this without getting into the VBE... But fair enough I could
have been more explicit... Thanks... ;-)

"Ron de Bruin" wrote:

Hi Jim

xlVeryHidden (which can only be set in code so it probably does not apply)


You can do it manual in the VBA editor
Alt-F11
Select the sheet
Press F4
Change visible in the properties

See my code example also

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



"Jim Thomlinson" wrote in message
...
try this...

Sub PrintSpecificSheet()
Dim wks As Worksheet

Set wks = ActiveWorkbook.Sheets("Sheet2")
If wks.Visible < xlSheetVisible Then
Application.ScreenUpdating = False
wks.Visible = xlSheetVisible
wks.PrintOut
wks.Visible = xlSheetHidden
Application.ScreenUpdating = True
Else
wks.PrintOut
End If
Set wks = Nothing
End Sub

The only side effect to the code is that if the sheet was previously set as
xlVeryHidden (which can only be set in code so it probably does not apply)
then after the procedure is run it will only be xlHidden. There is a 99.9%
chance that you really don't need to wory about this.

HTH

"Glenn" wrote:

I was give the following to make a button to print a sheet. But how do i
make this macro to print a hidden sheet?
I really do appreciate everyone's help
GlennHi Glenn
---------------------------------------------------------------------------
Identify the specific sheet you want to print in the code.....

Sub PrintSpecificSheet()
ActiveWorkbook.Sheets("Sheet2").PrintOut
End Sub
--

-----
XL2003
Regards

William




"Glenn" wrote in message
...
I am a novice learning....
I would like to know how I can write a macro that would make a particular
worksheet print. I would like to press a button on one sheet and make
another sheet print.
Thanks for your help,
Glenn





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
Assign Macro with Hidden Sheet Pran Excel Worksheet Functions 5 August 4th 09 01:32 PM
Macro to run on hidden sheet Tel Excel Discussion (Misc queries) 4 June 26th 09 09:08 PM
Using a Macro to look at Hidden Sheet alice Excel Discussion (Misc queries) 7 April 20th 07 09:16 AM
I need my Hidden Rows to stay hidden when I print the sheet. Rosaliewoo Excel Discussion (Misc queries) 2 July 20th 06 07:51 PM
Macro dependent on hidden sheet? Cee_Pritchard Excel Programming 4 October 15th 04 01:29 PM


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

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

About Us

"It's about Microsoft Excel"