Opening File Open Dialog Box In A Specific Folder

markkramer

Board Regular
Joined
May 8, 2002
Messages
162
Hi.

I'm trying to develop a macro that brings up the File Open dialog box in a specific folder. I found the following code in several places on Mr. Excel but found it still opened up the dialog box in my C:\TEMP folder. Any ideas on how to get it to open in the U:\PAR folder?

Thanks for you help!

Mark

Dim DIRECTORY As String
Dim fileToOpen As Boolean
DIRECTORY = "u:\par\"
ChDir DIRECTORY
fileToOpen = Application.GetOpenFilename("Excel Files (u:\par\*.xls), *.xls")
Workbooks.Open fileToOpen
 
Sure, but I think you are over-complicating it. You could simply browse once the Open dialog is loaded. Why would you need to duplicate the function of the built-in dialog box?
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
OK I figured it out.

Need to change to Workbooks.OpenText in order to get the import text editor to open.

I need to open the dat file in that manner to have the data sorted properly in columns (with comma as a delimiter), otherwise if I just open the dat file without the text import wizard the data is all messed up, making it difficult to process later.

Any thanks for your original script, helps me a lot (y)
 
Upvote 0

Forum statistics

Threads
1,214,927
Messages
6,122,309
Members
449,080
Latest member
jmsotelo

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