Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#12
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#13
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
First page of Excel sheerepeats in print layout or print preview | Excel Discussion (Misc queries) | |||
Print and Print Preview Graphic Moving Resizing 2007/2003 | Excel Discussion (Misc queries) | |||
print preview v page break preview | Excel Discussion (Misc queries) | |||
cell borders that I create dont show on print preview or print | Excel Discussion (Misc queries) | |||
Why does macro speed slow after Excel Print or Print Preview? | Excel Programming |