VBA for opening a file from the filename in a cell

csilabgirl

Active Member
Joined
Aug 14, 2009
Messages
359
Excel 2002

I would like the user to be able to enter a file name into a cell (A1) and then click a button and it will open that file

The file name in this example is M060311 and I have it in cell A1.

In cell A17 I am using formulas to decipher the file name for its location on the server. So in cell A17 I have the file path:

\\Server\chromosomal labs\Integrated Sample Processing System (I-SPS)\Run Files\Minifiler\2011\Jun\M060311

What do I need to write into my VBA code to open this workbook?

Thank you for your help!
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Refer to the cell but you will need to add the extension. Something like this

Workbooks.open range("a17").value & ".xls"
 
Upvote 0

Forum statistics

Threads
1,224,570
Messages
6,179,611
Members
452,931
Latest member
The Monk

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top