dumb question

  • Thread starter Thread starter john m
  • Start date Start date
J

john m

hello,

how to set the default path that the filedialog looks at?

i see an application default path but i cant seem to set it. and the file
dialog object doesnt seem to have that property

thanks for any hint

jm
 
Just keep track of where you are, change to where you want to be, show the
dialog and set it back to where you were:

(Most of this was stolen from the help for .filedialog)

Option Explicit
Sub testme()

Dim lngCount As Long
Dim curFolder As String
Dim newFolder As String

curFolder = CurDir
newFolder = "C:\test"

ChDrive newFolder
ChDir newFolder

' Open the file dialog
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = True
.Show

' Display paths of each file selected
For lngCount = 1 To .SelectedItems.Count
MsgBox .SelectedItems(lngCount)
Next lngCount

End With

ChDrive curFolder
ChDir curFolder

End Sub
 
John
Click on Tools - Options - General tab. Look for "Default file
location:" Put the entire path to the folder you want. HTH Otto
 
Back
Top