msoFileDialogFilePicker doesn't list files
Posted on 2011-03-03
I have an procedure which is supposed to allow the user to choose which text file is to be imported into the application for processing. It uses msoFileDialogFilePicker in a seperate sub-procedure to accomplish this. The problem is that when the user navigates to the proper folder no files are visible in the folder, although they are definitely there. I have commented out the line in the sub-procedure which originally applied a filter to msoFileDialogFilePicker. I call the sub with the following lines of code:
MsgBox "Select MLPA4 Text File"
strMlpa4Path = GetLocation()
MsgBox "Select MLPA6 Text File"
strMlpa6Path = GetLocation()
And the sub looks like this:
Public Function GetLocation()
Dim fd As FileDialog
Dim objfl As Variant
Dim filename As String
Set fd = Application.FileDialog(msoFileDialogFilePicker)
.ButtonName = "Select"
.AllowMultiSelect = False
'.Filters.Add "All Files", "*.*"
.Title = "Choose File to Import"
.InitialView = msoFileDialogViewDetails
For Each objfl In .SelectedItems
GetLocation = objfl
On Error GoTo 0