Opening workbooks with names taken from another workbook

G

Gilbert De Ceulaer

I have 16 workbooks each with multiple worksheets.
They are opened via a "EXCEL.EXE Book1 Book2 ...."-command
All workbooks contain data that are linked. Most of the relations go only to
previous books, so I have no problems with circular calculation.

Book1 - called "CONNECTIONS" - contains al the connecting parameters.
All 15 following workbooks take the necessary addresses from
"CONNECTIONS.DBX".
So when I change the setup of a worksheet in one of the workbooks, I only
have to change it's addresses in "CONNECTIONS.DBX", and all referals to the
data in that workbook are changed in all 15 workbooks.

On the first line of this CONNECTIONS.DBX are the names of the 15 following
workbooks.

Question :
Is there any way to open all the consecutive workbooks by using the data on
this first line ?
So I could change the "EXCEL.EXE Book1 Book2 ...."-command into "EXCEL.EXE
CONNECTIONS"

Thanks in advance,
Gilbert
 
G

Gary''s Student

Here is a small macro. I used CONNECTIONS.xls rather than CONNECTIONS.DBX:


Sub Macro1()

' gsnu

Dim s As String
Dim i As Integer
For i = 1 To 15
s = Cells(1, i).Value
Workbooks.Open Filename:=s
Windows("CONNECTIONS.xls").Activate
Next
End Sub

Where cell A1 contains:
C:\Documents and Settings\Owner\Desktop\triangle.xls

etc.
 
G

Gilbert De Ceulaer

Dear Gary,
(.DBX was a "lapsus", .XLS is right)
What is triangle.xls
Gilbert
 
G

Gary''s Student

a small workbook I use to calculate the area of a traingle. just a sample to
verify the macro works
 

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

Top