Find File Window - Workbook when its not in same folder location

Grimm127

Board Regular
Joined
Aug 17, 2011
Messages
132
Hi All,

I have a question. I have the following code saved in my macro:


'Open ITEM MASTER SKU
Workbooks.Open Filename:= _
"R:\Shared\TEAM\VMI FILES\ITEM Master SKU (NEW).xlsx", ReadOnly:=True, Notify:=False

However, I would like to add in some code that will open a find file window if the above code doesn't locate the file.

Reason is that I sometimes take the files with me and then I save them on another computer and I don't want to rewrite the above code everytime I switch it up.

Can you help me out?
Thanks!
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Take a look at the Application.GetOpenFilename Method in VBA Help. Will allow you to select the file(s) you want to reference in your code. Doesn't actually open the file(s), but returns the name and can include the path to the folder where the file(s) resides.
 
Upvote 0
I "F1" in the help and past in and I get an error. I even type it out and still no luck.
Open the VBE window. Type "getopenfilename" (without the quote marks) in the search box (upper right corner) and press Enter.
 
Upvote 0
Did it exactly like you said and still I get "Sorry, there are no results for getopenfilename" Try rephrasing your query.
 
Upvote 0
Did it exactly like you said and still I get "Sorry, there are no results for getopenfilename" Try rephrasing your query.
What version of Excel are you using? As an alternative google "Excel VBA GetOpenFileName".
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

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