To All,
I'm trying to get the results of the GetOpenFileName() to filter all
files in the directory so that only those files that begin with the
letters: "ROSTER" are presented as a choice to Select from.
Currently, my code presents all .xls files in the directory and when
the dialog box pops up, I have to type in the 'FileName' box: ROSTER*
(then tab key) - only then do the filtered results of the dialogue
box match what I'm attempting to do through code ...
Any guidance would be greatly appreciated ...
Dim sDir As String
sDir = ThisWorkbook.Path ' Set path = to directory workbook is
stored in
Dim fnROSTER_MASTER As Variant
Dim strFilter As String: Dim strTitle As Variant
strFilter = "Excel (*.xls),*.xls" ' Another Example of filtered
input
strTitle = "SELECT ROSTER file"
ChDrive sDir
ChDir sDir
' Get the CPC file name
fnROSTER_MASTER = Application.GetOpenFilename(strFilter,
Title:=strTitle)
' Did USER abort/cancel the reguest?
If fnROSTER_MASTER = False Then
Exit Function
End If
Bookmarks