PDA

View Full Version : Printing Specific Pages Based On Dropdown



nickirvine
06-23-2008, 09:13 AM
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:

Private Sub CommandButton1_Click()
ActiveDocument.PrintOut Background:=False
End Sub

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.

fumei
06-23-2008, 09:44 AM
It would something like:

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



Case A (or B) will have to be defined by you. It could be either by text, or by Index number.' 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

nickirvine
06-24-2008, 08:56 AM
Thanks. I shall give it a try.