Try some code like
Dim SaveDir As String
Dim OpenDir As String
Dim FName As Variant
' save the current directory
SaveDir = CurDir
' set the new default directory
OpenDir = "C:\NewDirectory"
ChDrive OpenDir
ChDir OpenDir
' display the dialog
FName = Application.GetOpenFilename()
' restore the old directory
ChDrive SaveDir
ChDir SaveDir
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
On Sun, 23 Aug 2009 14:21:01 -0700, CLR
<(E-Mail Removed)> wrote:
>Hi All.......
>
>The following code works fine, but always starts in "My documents". Is it
>possible with code to specify which directory it will start in, and to only
>display Directories and not files?
>
>Sub SelectDirectory()
> Dim str As String
> str = Application.GetOpenFilename
>End Sub
>
>TIA for any assistance.
>
>Vaya con Dios,
>Chuck, CABGx3
>