![]() |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 11:46 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com