I have always run this code to retrieve the file path of the folder I select. But for some reason now I am getting a subscript out of range error now.
Public Function GetFolder()
Dim objFileDialog As Office.FileDialog
Set objFileDialog = Application.FileDialog(MsoFileDialogType.msoFileDialogFolderPicker)
With objFileDialog
.InitialFileName = "G:\"
.AllowMultiSelect = True
.ButtonName = "Folder Picker"
.Title = "Folder Picker"
If (.Show > 0) Then
End If
If (.SelectedItems.Count > 0) Then
GetFolder = .SelectedItems(1)
End If
End With
End Function
Running the code and expecting to retrieve a file path string.