Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Assign Macro with Hidden Sheet | Excel Worksheet Functions | |||
Macro to run on hidden sheet | Excel Discussion (Misc queries) | |||
Using a Macro to look at Hidden Sheet | Excel Discussion (Misc queries) | |||
I need my Hidden Rows to stay hidden when I print the sheet. | Excel Discussion (Misc queries) | |||
Macro dependent on hidden sheet? | Excel Programming |