ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   using a workbook to open more workbooks with filenames stored in cells (https://www.excelbanter.com/excel-programming/381202-using-workbook-open-more-workbooks-filenames-stored-cells.html)

[email protected]

using a workbook to open more workbooks with filenames stored in cells
 
hello
i am having issues using VBA code for opening up workbooks within a
workbook.
i need to open up 6 other workbooks when the master workbook is opened.
i was playing around with some code i found on this group and i got 1
to work, but then when it tried to open the second one it said error
1004 cannot open " or something like that.
i have filenames of the workbooks i need to open stored in cells.
i know i'm supposed to use some form of Workbooks.Open code in this
somewhere, but thats about all i've got down, minus referencing the
cells.
sorry i'm a newb but we all have to start somewhere.
anyone have any ideas for this code? for opening multiple workbooks?

thanks in advance!
aaron ward


[email protected]

using a workbook to open more workbooks with filenames stored in cells
 
oh i forgot to mention,
there is a possibility that the files the workbook will be looking for
to open will not have been created yet. is there an if does not exist
function or something i could use?


Bob Phillips

using a workbook to open more workbooks with filenames stored in cells
 
Private Sub Workbook_Open()
With Worksheets("Sheet1")
Workbooks.Open Filename:=.Range("A1").Value
Workbooks.Open Filename:=.Range("A2").Value
Workbooks.Open Filename:=.Range("A3").Value
'etc.
End With
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


wrote in message
ups.com...
hello
i am having issues using VBA code for opening up workbooks within a
workbook.
i need to open up 6 other workbooks when the master workbook is opened.
i was playing around with some code i found on this group and i got 1
to work, but then when it tried to open the second one it said error
1004 cannot open " or something like that.
i have filenames of the workbooks i need to open stored in cells.
i know i'm supposed to use some form of Workbooks.Open code in this
somewhere, but thats about all i've got down, minus referencing the
cells.
sorry i'm a newb but we all have to start somewhere.
anyone have any ideas for this code? for opening multiple workbooks?

thanks in advance!
aaron ward




[email protected]

using a workbook to open more workbooks with filenames stored in cells
 
WOW! thanks bob, your code works great. thank you so much!

-aaron


[email protected]

using a workbook to open more workbooks with filenames stored in cells
 
do you know of any code off the top of your head that once all the
spreadsheets are open returns the vieable workspace to the original
spreadsheet?

-aaron


Bob Phillips

using a workbook to open more workbooks with filenames stored in cells
 
What exactly do you mean Aaron?

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


wrote in message
ps.com...
do you know of any code off the top of your head that once all the
spreadsheets are open returns the vieable workspace to the original
spreadsheet?

-aaron





All times are GMT +1. The time now is 04:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com