Print macro problem

DSLA

Active Member
Joined
Jun 6, 2005
Messages
296
Hello, I need a bit of help with this one.

I have a macro that should print the 1st page in another Workbook, but I only have this macro witch print the active page of the Workbook.

Question is: How can I specify the sheet I want to be printed?


Private Sub CommandButton8_Click()
Dim x As String
x = "Pakkaus01.xls"
Workbooks.Open ActiveWorkbook.Path & "\" & x, 3
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Application.DisplayAlerts = False
Workbooks("Pakkaus01.xls").Close
Application.DisplayAlerts = True

End Sub
 

Some videos you may like

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

BrianB

Well-known Member
Joined
Feb 17, 2003
Messages
8,127
Something like this :-
Code:
Workbooks("book1.xls").Worksheets("Sheet1").PrintOut
'- etc
 

Watch MrExcel Video

Forum statistics

Threads
1,118,799
Messages
5,574,385
Members
412,590
Latest member
Velly
Top