Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Opening 4 files with 1 button?
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Opening 4 files with 1 button?
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 -- Dick Kusleika Excel MVP Daily Dose of Excel www.dicks-blog.com RustyR wrote: 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Opening 4 files with 1 button?
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 -- Regards Ron de Bruin http://www.rondebruin.nl "RustyR" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
show most recent files first when opening excel files | Excel Discussion (Misc queries) | |||
opening a worksheet with a command button on a form | Excel Discussion (Misc queries) | |||
Opening Quattro Pro for Windows files (*.WB1 Files) using Excel 20 | Excel Discussion (Misc queries) | |||
How can I view files chronologically when opening multiple files | Excel Discussion (Misc queries) | |||
Opening a worksheet with a button? | Excel Programming |