Excel VBA Code for searching and opening a file in dynamic folder path

exodia819

New Member
Joined
Jan 20, 2015
Messages
3
Hi Excel community,

I am a beginner in excel vba and want to ask this question. I want to be able to open the file that has selected date in it.

For an example,

Date input = May 1, 2015
Month = May (cell 1)
Date = 0501 (cell 2)


Then, run macro, it will attempt to find the folder name "May" (cell 1) and sub folder name"0501" (cell 2) and locate 'Report_05012015.xlsm' from the specified directory.

When found the specific file, open the workbook, Otherwise, open the latest dated report.

Folder path is U:\work\Report\May\0501\Report_05012015.xls

Thank you in advance,

Paul
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,217,343
Messages
6,136,007
Members
449,977
Latest member
altizerc2196

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