Going to Specified Folderr


Posted by Ryan on June 19, 2000 12:45 PM

I was wondering if anybody knew the arguments for the GetOpenFile method or the Application.Dialogs(xlDialogOpen).Show to start at one particular folder each time, instead of the "default folder" or the last used one. Thanks,
Ryan



Posted by Ivan Moala on June 21, 0100 1:19 AM

Hi Ryan
Use the getopenfile instead of the Dialogs option
as this is limited in what you can do.
With the GetOpenFile you have a number of options.
eg.FileFilter, FilterIndex, Title, ButtonText, MultiSelect - have alook @ online help.
To get the GetOpenFile to open @ your dir use something
like this;

Sub openf()
Dim FileNm As Variant
Dim OldDir As String

OldDir = CurDir 'saves current directory
ChDir "D:\aa" 'Change this to your Dir
FileNm = Application.GetOpenFilename
If FileNm = False Then ChDir OldDir: End
Workbooks.Open FileNm

End Sub

ie. Use the ChDir BEFORE you use the function,
then restore it if you need to.


Ivan