Print Another Excel File's Worksheet

  • Thread starter Thread starter Andy
  • Start date Start date
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top