Hello,
Can some one help me please...I need the folder dialog to always start at the C: directory but it seems to go wherever I was last working. Here is the code:
I tried putting this line in at the beginning
but it had no effect.
Thank you.
Can some one help me please...I need the folder dialog to always start at the C: directory but it seems to go wherever I was last working. Here is the code:
Code:
Public Sub Get_Folder()
On Error GoTo ErrorHandler
Dim fldr As FileDialog
Dim sItem As String
Dim sInitDir As String
Set fldr = Application.FileDialog(msoFileDialogFolderPicker)
sInitDir = CurDir
With fldr
.Title = " Please select a folder where program files can be placed. Clicking OK selects the C Drive."
.AllowMultiSelect = False
.InitialFileName = "C:"
If .Show <> -1 Then GoTo NextCode
sItem = .SelectedItems(1)
End With
ChDir sInitDir
NextCode:
Range("B2").Value = sItem
Set fldr = Nothing
ChDir sInitDir
Exit Sub
ErrorHandler:
ChDir sInitDir
Exit Sub
End Sub
Code:
ChDir "C:"
Thank you.