Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel : VBA to print pages 1 and 3 2

Status
Not open for further replies.

dvirgint

Programmer
Jun 28, 2010
85
CA
Hello All,

I have an Excel worksheet which scrapes information from another program. Depending on the length of the scraped information I may have to print page 1, 2 and 3. If there isn't enough information, I only print page 1 and 3. I know how to print page 1 to 3, however I can't find out how to print page 1 and 3.

Here is the code I would normally use:

Code:
Private Sub CommandButton3_Click()

        If Range("B55:B55") = "" Then
            ActiveWindow.SelectedSheets.PrintOut From:=1, To:=3, Copies:=1, Collate _
                :=True
        Else
            ActiveWindow.SelectedSheets.PrintOut From:=1, [aqua][b]and[/b][/aqua]:=3, Copies:=1, Collate _
                :=True
        End If

End Sub

Is it even possible to print selected pages?

Thanks for any help.
 
hi,

insert a manual page break between each page from the system from which you are importing data.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
What about this ?
Code:
Private Sub CommandButton3_Click()
If Range("B55:B55") = "" Then
    ActiveWindow.SelectedSheets.PrintOut From:=1, To:=3, Copies:=1, Collate:=True
Else
    ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1, Collate:=True
    ActiveWindow.SelectedSheets.PrintOut From:=3, To:=3, Copies:=1, Collate:=True
End If
End Sub

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
BTW, there is a difference between sheets and pages, just in case you were not making a distinction in your mind.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top