![]() |
Print Preview
My UserForm takes the whole screen. I have many CommandButtons, and one of
them is "Print Preview". I don't want the user to see the sheet (it's an "auto_open"), all controls will be done by using the UserForm. I have this: Private Sub CommandButton6_Click() On Error Resume Next Worksheets(1).Select ActiveSheet.PrintPreview Me.Hide End Sub But it's not working. It freezes Excel, and all I have to do is Ctrl + Alt + Del. Can some help me? I tried searching the past topics, but none of them really helped me. |
Print Preview
You have me confused. If you do not want the sheet displayed, why do you
call print preview? What is the purpose of calling print preview at that point? "Eddie_SP" wrote in message ... My UserForm takes the whole screen. I have many CommandButtons, and one of them is "Print Preview". I don't want the user to see the sheet (it's an "auto_open"), all controls will be done by using the UserForm. I have this: Private Sub CommandButton6_Click() On Error Resume Next Worksheets(1).Select ActiveSheet.PrintPreview Me.Hide End Sub But it's not working. It freezes Excel, and all I have to do is Ctrl + Alt + Del. Can some help me? I tried searching the past topics, but none of them really helped me. |
Print Preview
The Me keyword refers to the object holding the code which can be a general
module, a sheet module or a form module. So if you want the button to hide: Private Sub CommandButton6_Click() On Error Resume Next Worksheets(1).Select ActiveSheet.PrintPreview Me.CommandButton6.Hide End Sub "Eddie_SP" wrote in message ... My UserForm takes the whole screen. I have many CommandButtons, and one of them is "Print Preview". I don't want the user to see the sheet (it's an "auto_open"), all controls will be done by using the UserForm. I have this: Private Sub CommandButton6_Click() On Error Resume Next Worksheets(1).Select ActiveSheet.PrintPreview Me.Hide End Sub But it's not working. It freezes Excel, and all I have to do is Ctrl + Alt + Del. Can some help me? I tried searching the past topics, but none of them really helped me. |
Print Preview
Hi JLGWhiz !
The purpose is to see the final document already filled out. It's a standard document. So at the end, after giving all the data, I want to have a preview of what the user have done, if it's "ok" press button "Print", if it's not "ok" press button "Correct document". But always my UserForm will be on Top. Tks. "JLGWhiz" wrote: You have me confused. If you do not want the sheet displayed, why do you call print preview? What is the purpose of calling print preview at that point? "Eddie_SP" wrote in message ... My UserForm takes the whole screen. I have many CommandButtons, and one of them is "Print Preview". I don't want the user to see the sheet (it's an "auto_open"), all controls will be done by using the UserForm. I have this: Private Sub CommandButton6_Click() On Error Resume Next Worksheets(1).Select ActiveSheet.PrintPreview Me.Hide End Sub But it's not working. It freezes Excel, and all I have to do is Ctrl + Alt + Del. Can some help me? I tried searching the past topics, but none of them really helped me. |
Print Preview
Try hiding the userform first:
Private Sub CommandButton6_Click() me.hide with worksheets(1) .visible = xlsheetvisible .PrintPreview .visible = xlsheethidden end with Me.show End Sub Eddie_SP wrote: My UserForm takes the whole screen. I have many CommandButtons, and one of them is "Print Preview". I don't want the user to see the sheet (it's an "auto_open"), all controls will be done by using the UserForm. I have this: Private Sub CommandButton6_Click() On Error Resume Next Worksheets(1).Select ActiveSheet.PrintPreview Me.Hide End Sub But it's not working. It freezes Excel, and all I have to do is Ctrl + Alt + Del. Can some help me? I tried searching the past topics, but none of them really helped me. -- Dave Peterson |
Print Preview
No to a General module, but yes to a class module (for the Me keyword).
JLGWhiz wrote: The Me keyword refers to the object holding the code which can be a general module, a sheet module or a form module. So if you want the button to hide: Private Sub CommandButton6_Click() On Error Resume Next Worksheets(1).Select ActiveSheet.PrintPreview Me.CommandButton6.Hide End Sub "Eddie_SP" wrote in message ... My UserForm takes the whole screen. I have many CommandButtons, and one of them is "Print Preview". I don't want the user to see the sheet (it's an "auto_open"), all controls will be done by using the UserForm. I have this: Private Sub CommandButton6_Click() On Error Resume Next Worksheets(1).Select ActiveSheet.PrintPreview Me.Hide End Sub But it's not working. It freezes Excel, and all I have to do is Ctrl + Alt + Del. Can some help me? I tried searching the past topics, but none of them really helped me. -- Dave Peterson |
Print Preview
Should use visible property for controls.
Private Sub CommandButton6_Click() On Error Resume Next Worksheets(1).Select ActiveSheet.PrintPreview Me.CommandButton6.Visible = False End Sub I assume you know how to make it visible when you need it again. "JLGWhiz" wrote in message ... The Me keyword refers to the object holding the code which can be a general module, a sheet module or a form module. So if you want the button to hide: Private Sub CommandButton6_Click() On Error Resume Next Worksheets(1).Select ActiveSheet.PrintPreview Me.CommandButton6.Visible = False End Sub "Eddie_SP" wrote in message ... My UserForm takes the whole screen. I have many CommandButtons, and one of them is "Print Preview". I don't want the user to see the sheet (it's an "auto_open"), all controls will be done by using the UserForm. I have this: Private Sub CommandButton6_Click() On Error Resume Next Worksheets(1).Select ActiveSheet.PrintPreview Me.Hide End Sub But it's not working. It freezes Excel, and all I have to do is Ctrl + Alt + Del. Can some help me? I tried searching the past topics, but none of them really helped me. |
Print Preview
Thanks for the correction Dave. I think I am having a bad hair day.
"Dave Peterson" wrote in message ... No to a General module, but yes to a class module (for the Me keyword). JLGWhiz wrote: The Me keyword refers to the object holding the code which can be a general module, a sheet module or a form module. So if you want the button to hide: Private Sub CommandButton6_Click() On Error Resume Next Worksheets(1).Select ActiveSheet.PrintPreview Me.CommandButton6.Hide End Sub "Eddie_SP" wrote in message ... My UserForm takes the whole screen. I have many CommandButtons, and one of them is "Print Preview". I don't want the user to see the sheet (it's an "auto_open"), all controls will be done by using the UserForm. I have this: Private Sub CommandButton6_Click() On Error Resume Next Worksheets(1).Select ActiveSheet.PrintPreview Me.Hide End Sub But it's not working. It freezes Excel, and all I have to do is Ctrl + Alt + Del. Can some help me? I tried searching the past topics, but none of them really helped me. -- Dave Peterson |
Print Preview
Hi Dave,
Thank you very much for your help ! It worked the way I wanted. But there is an error at end: "UNABLE TO SET VISIBLE PROPERTY OF THE WORKSHEET CLASS". Can you help on that? Thank you once again ! Eddie. "Dave Peterson" wrote: Try hiding the userform first: Private Sub CommandButton6_Click() me.hide with worksheets(1) .visible = xlsheetvisible .PrintPreview .visible = xlsheethidden end with Me.show End Sub Eddie_SP wrote: My UserForm takes the whole screen. I have many CommandButtons, and one of them is "Print Preview". I don't want the user to see the sheet (it's an "auto_open"), all controls will be done by using the UserForm. I have this: Private Sub CommandButton6_Click() On Error Resume Next Worksheets(1).Select ActiveSheet.PrintPreview Me.Hide End Sub But it's not working. It freezes Excel, and all I have to do is Ctrl + Alt + Del. Can some help me? I tried searching the past topics, but none of them really helped me. -- Dave Peterson |
Print Preview
By the way...
My workbook is not protected. "Dave Peterson" wrote: Try hiding the userform first: Private Sub CommandButton6_Click() me.hide with worksheets(1) .visible = xlsheetvisible .PrintPreview .visible = xlsheethidden end with Me.show End Sub Eddie_SP wrote: My UserForm takes the whole screen. I have many CommandButtons, and one of them is "Print Preview". I don't want the user to see the sheet (it's an "auto_open"), all controls will be done by using the UserForm. I have this: Private Sub CommandButton6_Click() On Error Resume Next Worksheets(1).Select ActiveSheet.PrintPreview Me.Hide End Sub But it's not working. It freezes Excel, and all I have to do is Ctrl + Alt + Del. Can some help me? I tried searching the past topics, but none of them really helped me. -- Dave Peterson |
Print Preview
"Dave Peterson" wrote: Try hiding the userform first: Private Sub CommandButton6_Click() me.hide with worksheets(1) .visible = xlsheetvisible .PrintPreview .visible = xlsheethidden end with Me.show End Sub Eddie_SP wrote: My UserForm takes the whole screen. I have many CommandButtons, and one of them is "Print Preview". I don't want the user to see the sheet (it's an "auto_open"), all controls will be done by using the UserForm. I have this: Private Sub CommandButton6_Click() On Error Resume Next Worksheets(1).Select ActiveSheet.PrintPreview Me.Hide End Sub But it's not working. It freezes Excel, and all I have to do is Ctrl + Alt + Del. Can some help me? I tried searching the past topics, but none of them really helped me. -- Dave Peterson |
Print Preview
Solved !
..Visible = xlSheetVisible Thank you very much ! "Dave Peterson" wrote: Try hiding the userform first: Private Sub CommandButton6_Click() me.hide with worksheets(1) .visible = xlsheetvisible .PrintPreview .visible = xlsheethidden end with Me.show End Sub Eddie_SP wrote: My UserForm takes the whole screen. I have many CommandButtons, and one of them is "Print Preview". I don't want the user to see the sheet (it's an "auto_open"), all controls will be done by using the UserForm. I have this: Private Sub CommandButton6_Click() On Error Resume Next Worksheets(1).Select ActiveSheet.PrintPreview Me.Hide End Sub But it's not working. It freezes Excel, and all I have to do is Ctrl + Alt + Del. Can some help me? I tried searching the past topics, but none of them really helped me. -- Dave Peterson |
Print Preview
Glad you found the solution.
I'm betting that you typed the code instead of copy|pasting from the newsgroup post. (And you made a typo--I don't see a difference between your solution and my suggestion.) Eddie_SP wrote: Solved ! .Visible = xlSheetVisible Thank you very much ! "Dave Peterson" wrote: Try hiding the userform first: Private Sub CommandButton6_Click() me.hide with worksheets(1) .visible = xlsheetvisible .PrintPreview .visible = xlsheethidden end with Me.show End Sub Eddie_SP wrote: My UserForm takes the whole screen. I have many CommandButtons, and one of them is "Print Preview". I don't want the user to see the sheet (it's an "auto_open"), all controls will be done by using the UserForm. I have this: Private Sub CommandButton6_Click() On Error Resume Next Worksheets(1).Select ActiveSheet.PrintPreview Me.Hide End Sub But it's not working. It freezes Excel, and all I have to do is Ctrl + Alt + Del. Can some help me? I tried searching the past topics, but none of them really helped me. -- Dave Peterson -- Dave Peterson |
All times are GMT +1. The time now is 10:10 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com