Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default form with print preview


Hi guys back again

I have a user form with 3 options buttons and one command button you
press when you have selected one

Option button 1. is a print a worksheet out (that works fine)

option button 3. is a return to main sheet (that works fine)

It is the second option button i have that has problems it is a print
preview options
I recorded a macro to show a print preview of the worksheet but when
you select this in goes in to the print preview but the form remains in
the print preview page and it crashes excel!!!!

He is my code

Private Sub CommandButton1_Click()
If OptionButton1 Then
Sheets("mini worksheet").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("mini input").Select
ElseIf OptionButton2 Then
Sheets("mini worksheet").Select
ActiveWindow.SelectedSheets.printpreview
ElseIf OptionButton3 Then
Sheets("Heroal main page ").Select
End If

End Sub

Can you help

Thanks


--
raw
------------------------------------------------------------------------
raw's Profile: http://www.excelforum.com/member.php...o&userid=28312
View this thread: http://www.excelforum.com/showthread...hreadid=479967

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default form with print preview


Good evening raw

The print preview window is a completely different kettle of fish to
the normal worksheet view window I'm afraid, and as such is completely
incompatible with userforms.

There is a way around it, and that it is to close the userform before
the print preview command is invoked. Once you call the print preview
window, control of the macro appears to be lost as Excel moves out of
its normal environment, and as such your macro would have to terminate
as the print preciew command is executed.

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=479967

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default form with print preview

"raw" wrote
: Hi guys back again
:
: I have a user form with 3 options buttons and one command button you
: press when you have selected one
:
: Option button 1. is a print a worksheet out (that works fine)
:
: option button 3. is a return to main sheet (that works fine)
:
: It is the second option button i have that has problems it is a print
preview options
: I recorded a macro to show a print preview of the worksheet but when
: you select this in goes in to the print preview but the form remains in
: the print preview page and it crashes excel!!!!
:
: He is my code
:
: Private Sub CommandButton1_Click()
: If OptionButton1 Then
: Sheets("mini worksheet").Select
: ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
: Sheets("mini input").Select
: ElseIf OptionButton2 Then
: Sheets("mini worksheet").Select

Me.Hide '<---Add this line here*******

: ActiveWindow.SelectedSheets.printpreview
: ElseIf OptionButton3 Then
: Sheets("Heroal main page ").Select
: End If
:
: End Sub
:
: Can you help
:
: Thanks
:
: --
: raw


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
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
Print Preview and Modeless Form tmort[_2_] Excel Programming 1 July 22nd 05 09:05 PM
Print preview in a user form Scott Excel Programming 2 October 8th 04 12:05 PM


All times are GMT +1. The time now is 09:14 PM.

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"