ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Print Another Excel File's Worksheet (https://www.excelbanter.com/excel-programming/427330-print-another-excel-files-worksheet.html)

Andy

Print Another Excel File's Worksheet
 
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

Patrick Molloy[_2_]

Print Another Excel File's Worksheet
 
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


"Andy" wrote:

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



All times are GMT +1. The time now is 06:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com