Opening 4 files with 1 button?

  • Thread starter Thread starter RustyR
  • Start date Start date
R

RustyR

Hi,

I have a boss who needs to open 4 files each week to print.
Is there a way I can give him an Excel page with a button on it which Prints
these 4 files?

Any help would be appreciated!!

Regards,
Rusty
 
Rusty

You could use a Workspace to open all four files at once. See under the
File menu - Save As Workspace.

If you want a macro that opens, prints, and closes the files, it might look
like this

Sub Open4Files()

Dim aFnames As Variant
Dim sPath As String
Dim i As Long
Dim wb As Workbook

aFnames = Array("File1.xls", "file2.xls", "file3.xls", "file4.xls")
sPath = "C:\MyFolder\"

For i = LBound(aFnames) To UBound(aFnames)
Set wb = Workbooks.Open(sPath & aFnames(i))
wb.Windows(1).SelectedSheets.PrintOut
wb.Close savechanges:=False
Next i

End Sub
 
Hi RustyR

Try this if the files are closed (There is no error check)
It will print 4 files in the C:\Data\ folder

Sub test()
Dim wbname As Variant
Dim N As Integer
Dim wb As Workbook
wbname = Array("test1.xls", "test2.xls", "test3.xls", "test4.xls")
For N = LBound(wbname) To UBound(wbname)
Set wb = Workbooks.Open("C:\Data\" & wbname(N))
wb.PrintOut
wb.Close False
Next
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