Opening Multiple Workbooks from a macro with a twist

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 5 large excel files approx 12Mb each in a folder and I am trying to
access them programmatically from another excel file in the same directory (a
report template). When I call code to open them like

Workbooks.Open Filename:=sName (thanks tom) it takes a very long time, like
the computer is running out of memory. Is there a way for excel to access the
Workbook->Worksheet programmatically without actually opening the excel file?

I need to process all of the excel files from a separate one rather than
sticking the same macro in each file.

this is doing my head in
Any help greatly appreciated
Cheers
Doug
 
If you doing more than reading data from the files, you will need to open
them.
 
I have a button with a macro attached in a seperate workbook that opens 9
different workbooks ranging from 3 Mb to 29 Mb, refreshes them, saves and
closes

This is part of my code

ChDir "\\Usnt36\nalogistics\Nato rail\REPORTS\RFMS Access
Database\Metrics database"

Workbooks.Open Filename:="\\USNT36\nalogistics\Nato Rail\Reports\RFMS
Access Database\Metrics Database\Metrics Total Plastics Fleet.xls", _
WriteResPassword:="rfms", Password:="rfms"
ActiveWorkbook.RefreshAll
ActiveWindow.SelectedSheets.PrintOut Copies:=1
ActiveWorkbook.Save
ActiveWorkbook.Close

Workbooks.Open Filename:="\\USNT36\nalogistics\Nato Rail\Reports\RFMS
Access Database\Metrics Database\Metrics Total Tank & Hopper Car Fleet.xls", _
WriteResPassword:="rfms", Password:="rfms"
ActiveWorkbook.RefreshAll
ActiveWindow.SelectedSheets.PrintOut Copies:=1
ActiveWorkbook.Save
ActiveWorkbook.Close

etc... for each workbook. It works like a charm.
 

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