davidathoegh
New Member
- Joined
- Oct 6, 2010
- Messages
- 16
Hi all,
I produce a monthly pack which requires multiple worksheets in different excel files to be selected and printed (over 100pages).
What I need to do is activate a workbook, select the required worksheet(s) then print, then go to the next workbook.
For example, open up Report A file, select Sheet1 to sheet ?, print, then go to report B file and so on.
Through recording a macro and reading some threads, I have attempted to use the below code, repeating this code for around 40files which is specific to the file name/tab.
Workbooks("Report 1").Activate
Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
Sheets("Sheet1").Activate
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"
Sheets("Sheet1").Select
this works fine, but when the file name changes every month (file is dated), I manually do a find and replace in the code to change the date, then use the macro.
I know there is a better way to do this, but my skills are very basic, which is why I an open to any suggestions available....
I have now typed the file names required in a "Data" tab, where column E holds the report name and column F has the tab name.
e.g.
Report 1 tab1
Report 1 tab2
Report 2 tab1
Report 3 tab1
Etc etc
Any suggestions would be greatly appreciated.
DC
I produce a monthly pack which requires multiple worksheets in different excel files to be selected and printed (over 100pages).
What I need to do is activate a workbook, select the required worksheet(s) then print, then go to the next workbook.
For example, open up Report A file, select Sheet1 to sheet ?, print, then go to report B file and so on.
Through recording a macro and reading some threads, I have attempted to use the below code, repeating this code for around 40files which is specific to the file name/tab.
Workbooks("Report 1").Activate
Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
Sheets("Sheet1").Activate
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"
Sheets("Sheet1").Select
this works fine, but when the file name changes every month (file is dated), I manually do a find and replace in the code to change the date, then use the macro.
I know there is a better way to do this, but my skills are very basic, which is why I an open to any suggestions available....
I have now typed the file names required in a "Data" tab, where column E holds the report name and column F has the tab name.
e.g.
Report 1 tab1
Report 1 tab2
Report 2 tab1
Report 3 tab1
Etc etc
Any suggestions would be greatly appreciated.
DC