I am using VBA with Word 2003. I am using the FileDialog object to return the path and name of a folder that the user selects. How do I set the folder that FileDialog opens to? I have tried ChDrive and ChDir before opening the dialog, but it still opens to my Word's default file folder. Here is my code:
Code:
Private Sub cmdChange_Click()[green]
' Change drive and directory.[/green]
ChDrive g_strFolder
ChDir g_strFolder[green]
' Display FileDialog to set g_strFolder.[/green]
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
.ButtonName = "OK"
.Title = "Select Project Folder"
If .Show = 0 Then Exit Sub
g_strFolder = .SelectedItems(1)
End With[green]
' Set caption for lblProjectLocation.[/green]
Me.lblProjectLocation.Caption = g_strFolder
End Sub