Consulting

Results 1 to 5 of 5

Thread: pagebreakme

  1. #1
    VBAX Mentor
    Joined
    Jun 2005
    Posts
    374
    Location

    pagebreakme

    hello
    what is wrong with............
    [VBA]
    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"

    [/VBA]
    thanks
    moshe

  2. #2
    Moderator VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    If you put this in the sheet1 code this works for me to produce a print preview page.

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

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

  3. #3
    Administrator
    2nd VP-Knowledge Base
    VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    Get rid of "x = " in your Select Case structure

    [vba]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"[/vba]




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

  4. #4
    VBAX Mentor
    Joined
    Jun 2005
    Posts
    374
    Location
    hello
    can i toggle between...
    [VBA] ActiveWindow.view = xlPageBreakPreview[/VBA]
    and
    [VBA]ActiveWindow.view = xlNormalView[/VBA]
    namely can i turn from one to the other in one line?
    thanks
    moshe

  5. #5
    Administrator
    2nd VP-Knowledge Base VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    [VBA]Sub WindowToggle()
    If ActiveWindow.View = xlNormalView Then
    ActiveWindow.View = xlPageBreakPreview
    Else
    ActiveWindow.View = xlNormalView
    End If
    End Sub[/VBA]
    Is this what you mean?




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •