Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
FileDialog Filters.clear
I have the following "classical" code to use a filedialog control in Excel
2003: Function FileSelector(tipo As Integer) Dim fd As FileDialog Set fd = Application.FileDialog(msoFileDialogSaveAs) Dim vrtSelectedItem As Variant With fd .Filters.Clear .Filters.Add "MyCustomFiles", "*.trn" If .Show = -1 Then For Each vrtSelectedItem In .SelectedItems FileSelector = vrtSelectedItem Next vrtSelectedItem Else End If End With Set fd = Nothing End Function It performs correctly without the .Filters statements. With them, instead, I get the following error: Property or method not supported by the object I use Excel 2003/SP3 Any help? Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
FileDialog Filters.clear
Why don't you justt use GetSaveAsFileName???
Sub FileSelector() Dim fileSaveName As String fileSaveName = Application.GetSaveAsFilename( _ fileFilter:="MyCustomfiles (*.trn), *.trn") If fileSaveName < False Then MsgBox "Save as " & fileSaveName FileSelector = fileSaveName End If End Sub "eggpap" wrote: I have the following "classical" code to use a filedialog control in Excel 2003: Function FileSelector(tipo As Integer) Dim fd As FileDialog Set fd = Application.FileDialog(msoFileDialogSaveAs) Dim vrtSelectedItem As Variant With fd .Filters.Clear .Filters.Add "MyCustomFiles", "*.trn" If .Show = -1 Then For Each vrtSelectedItem In .SelectedItems FileSelector = vrtSelectedItem Next vrtSelectedItem Else End If End With Set fd = Nothing End Function It performs correctly without the .Filters statements. With them, instead, I get the following error: Property or method not supported by the object I use Excel 2003/SP3 Any help? Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Pivot Table Clear All Filters | Excel Discussion (Misc queries) | |||
How to save & reapply a set of excel filters after clear | Excel Discussion (Misc queries) | |||
VB to clear any filters when closing a spreadsheet | Excel Discussion (Misc queries) | |||
How to clear all filters in worksheet for all columns | Excel Discussion (Misc queries) | |||
Auto Open - Clear all filters | Excel Programming |