Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • 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
Dec 21, 2008
12
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
 
Replies continue below

Recommended for you

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