Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
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
First page of Excel sheerepeats in print layout or print preview philfrotonda Excel Discussion (Misc queries) 1 July 12th 07 09:28 PM
Print and Print Preview Graphic Moving Resizing 2007/2003 Adam Rayburn Excel Discussion (Misc queries) 0 April 4th 07 04:18 PM
print preview v page break preview SamB Excel Discussion (Misc queries) 0 November 16th 06 05:09 PM
cell borders that I create dont show on print preview or print scott3435 Excel Discussion (Misc queries) 2 April 6th 06 02:37 AM
Why does macro speed slow after Excel Print or Print Preview? Larry A[_3_] Excel Programming 6 May 16th 05 11:22 AM


All times are GMT +1. The time now is 10:00 AM.

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

About Us

"It's about Microsoft Excel"