Print Another Excel File's Worksheet

A

Andy

Hi Gang

I need code in one Excel file that will print the contents of another
Excel file worksheet. I'd like to be able to specify the folder and
file to print (ie. m:\governance\expensereport.xls).

Can anyone help?

Andy
 
P

Patrick Molloy

this should get you started ....



Sub FetchFile()
Dim sFileName As String
Dim wb As Workbook
sFileName = Application.GetOpenFilename("Excel Files (*.xls),*.xls")

'check if Cancelled
If UCase(sFileName) <> "FALSE" Then
Set wb = Workbooks.Open(sFileName, ReadOnly:=True)

wb.ActiveSheet.PrintOut Copies:=1, Collate:=True

wb.Close False 'close without saving!

End If
End Sub
 
Top