Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Code for Opening a Closed Workbook

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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Code for Opening a Closed Workbook

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.

--
Regards,
Tom Ogilvy

scrabtree23 wrote in message
...
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.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Code for Opening a Closed Workbook

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

-----Original Message-----
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.


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Code for Opening a Closed Workbook

No, that won't work.

See my post for the correct syntax.

--
regards,
Tom Ogilvy

Seth wrote in message
...
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

-----Original Message-----
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.


.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Closed toolbars keept re-opening Jo Scrimshire Excel Discussion (Misc queries) 1 April 17th 08 07:10 PM
Code for opening a workbook at a specific time!?! mike_vr Excel Discussion (Misc queries) 2 June 5th 07 04:55 PM
Help...Code to copy sheet from closed workbook [email protected] Excel Discussion (Misc queries) 1 March 28th 07 08:52 PM
How to alter content in a closed spreadsheet without opening it! mflibra Excel Discussion (Misc queries) 0 August 17th 06 02:18 AM
copy worksheet from closed workbook to active workbook using vba mango Excel Worksheet Functions 6 December 9th 04 07:55 AM


All times are GMT +1. The time now is 12:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"