PDA

View Full Version : pagebreakme



lior03
07-20-2006, 05:02 AM
hello
what is wrong with............

On Error GoTo err
Dim x As Integer
x = InputBox("select pagemode", "pagebreak")
Select Case x
Case 1
x = ActiveWindow.view = xlPageBreakPreview
Case 2
x = ActiveWindow.view = xlNormalView
End Select
Exit Sub
err:
MsgBox " wrong mode selected"


thanks

austenr
07-20-2006, 05:30 AM
If you put this in the sheet1 code this works for me to produce a print preview page.

Sub aa()
Dim x As Integer
x = InputBox("select pagemode", "pagebreak")
If x = "1" Then
ActiveWindow.SelectedSheets.PrintPreview
End If
End Sub

Haven't figured out how to return it to normal view but at least part of the problem is solved.

malik641
07-20-2006, 04:47 PM
Get rid of "x = " in your Select Case structure

On Error GoTo err
Dim x As Integer
x = InputBox("select pagemode", "pagebreak")
Select Case x
Case 1
ActiveWindow.View = xlPageBreakPreview
Case 2
ActiveWindow.View = xlNormalView
End Select
Exit Sub
err:
MsgBox " wrong mode selected"
:thumb

lior03
07-20-2006, 09:16 PM
hello
can i toggle between...
ActiveWindow.view = xlPageBreakPreview
and
ActiveWindow.view = xlNormalView
namely can i turn from one to the other in one line?
thanks

malik641
07-21-2006, 05:02 AM
Sub WindowToggle()
If ActiveWindow.View = xlNormalView Then
ActiveWindow.View = xlPageBreakPreview
Else
ActiveWindow.View = xlNormalView
End If
End Sub
Is this what you mean?