Consulting

Results 1 to 3 of 3

Thread: Printing Specific Pages Based On Dropdown

  1. #1

    Printing Specific Pages Based On Dropdown

    Hi Folks,

    I have created a little form that pops up to be used in word. So you enter details and it goes into a letter.

    I wonder if there is a way of selecting from a drop-down one of two options. If you select option one it prints page 1,2,4,5. If you select option two it prints 3,4,5.

    The code im using to print is:

    [vba] Private Sub CommandButton1_Click()
    ActiveDocument.PrintOut Background:=False
    End Sub[/vba]

    I'm guessing it will be an IF command?!

    Also I'm after a code that allows someone to edit their printer settings.

    Any help, as always is appreciated. Thanks.

  2. #2
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    It would something like:[vba]

    Select Case dropdown value
    Case A
    ActiveDocument.PrintOut Pages:=1,2,4 - 5
    Case B
    ActiveDocument.PrintOut Pages:=3-5
    End Select

    [/vba]

    Case A (or B) will have to be defined by you. It could be either by text, or by Index number.[vba]' by text

    Select Case Dropdown1.Text
    Case "1,2,4,5"
    ActiveDocument.PrintOut Pages:=1,2,4 - 5
    Case "3,4,5"
    ActiveDocument.PrintOut Pages:=3-5
    End Select


    ' by Index
    Select Case Dropdown1.ListIndex
    Case 0 ' the first item in the list
    ActiveDocument.PrintOut Pages:=1,2,4 - 5
    Case 1 ' the second item in the list
    ActiveDocument.PrintOut Pages:=3-5
    End Select

    [/vba]

  3. #3
    Thanks. I shall give it a try.

Posting Permissions

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