Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open file specified in Excel cell

Status
Not open for further replies.

XLnew

Computer
Joined
Dec 21, 2008
Messages
12
Location
US
Hello All,

I have a rather silly question on VBA/Excel:

In Excel, I have a sheet name specified in cell A1. Say the content of A1 reads myXLworkbook.xls

Now, what I would like to do is open this workbook (myXLworkbook.xls) from VBA. Currently, I use:

Workbooks.Open Filename:="X:\myXLworkbook.xls"

However, this is not excatly what I want, since, I would like to change the contents of cell A1 to say myXLworkbook2.xls and would want VBA to now open this workbook.

How does one achieve this?

I hope my question is clear.

Best Wishes,

XLNew
 
Just change

"X:\myXLworkbook.xls"

to

Range("A1")

or

Cells(1, 1)

-handleman, CSWP (The new, easy test)
 
Hello,

Thanks very much. I got it!

Best Wishes,

XLNew.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top