Code for Opening a Closed Workbook

  • Thread starter Thread starter scrabtree23
  • Start date Start date
S

scrabtree23

I am trying to open a closed workbook using VBA code. I
used this code:

Workbooks("Functions.xls").Open

In the "ThisWorkbook" Object using a Workbook_Open () and
got a "Subscript out of range" error.
 
Workbooks.Open Filename:="C:\My Files\Function.xls"

a workbook isn't in the workbooks collection (which is what you show) until
it is opened and is currently open.
 
You are getting the error because you are not specifying
the file path. This will work:

Workbooks("C:\My Documents\Functions.xls").Open

Of course, I have no idea where the "Functions.xls" has
been saved - replace with the proper directory.

Seth
 

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