I have created the following function to show a popup file selection window. It works great except for one thing, it does not accept the default string properly, or rather it ignores it. What I have tried to do is to pass "*.doc" as the default extension but it does not take. Does anyone have any ideas?
Thanks,
Phil
Here is the code:
Function DoComDialog(title As String, def_ext As String)
Rem This subroutine allows the user to pick a file and path from a popup menu
Dim commonDialog1 As New clsCommonDialog
With commonDialog1
.DialogTitle = title
.Filter = "Excel Spreadsheets (*.xls)|*.xls|Word Documents (*.doc)|*.doc|All files (*.*)|*.*"
.DefaultExt = def_ext
.ShowOpen
DoComDialog = .Filename
End With
End Function
Thanks,
Phil
Here is the code:
Function DoComDialog(title As String, def_ext As String)
Rem This subroutine allows the user to pick a file and path from a popup menu
Dim commonDialog1 As New clsCommonDialog
With commonDialog1
.DialogTitle = title
.Filter = "Excel Spreadsheets (*.xls)|*.xls|Word Documents (*.doc)|*.doc|All files (*.*)|*.*"
.DefaultExt = def_ext
.ShowOpen
DoComDialog = .Filename
End With
End Function