Gasman
Enthusiastic Amateur
- Local time
- Today, 19:47
- Joined
- Sep 21, 2011
- Messages
- 17,411
Well I changed the test from 4 to 2 and it still falls over at the Filters.Add ?Interesting - Yes it is late-bound, and I'm guessing I have only ever used it as a file picker for template files, not to SaveAs, as part of the file dialog.
I normally save all created export files with a descriptive name and the date in _yyyymmdd format, so can't say I would have seen the error.
Suffice to say, there is enough there to work with for the o/p, even if it is not that generic?
This seems to work on just a quick test?
Code:
If lngType <> 2 And lngType <> 4 Then
'Reset then add filter patterns separated by tildes (~) where
' multiple extensions are separated by semi-colons (;) and the
' description is separated from them by a comma (,).
' Example strPattern :
' "MS Access,*.ACCDB; *.MDB~MS Excel,*.XLSX; *.XLSM; *.XLS"
.filters.Clear
For Each varEntry In Split(strPattern, "~")
.filters.Add Split(varEntry, ",")(0), Split(varEntry, ",")(1)
Next varEntry
End If
'Set some default settings
.InitialFileName = strInitialDir
.AllowMultiSelect = False
.InitialView = 2 'msoFileDialogViewDetails
'Only return a value from the FileDialog if not cancelled.
If .Show Then strGetFileFolderName = .SelectedItems(1)
filters did not change to Filters even when I made fDialog a FileDialog object?