Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot Table Clear All Filters MichaelR Excel Discussion (Misc queries) 8 July 24th 08 07:12 PM
How to save & reapply a set of excel filters after clear BerkeleyWit Excel Discussion (Misc queries) 1 June 17th 08 01:15 PM
VB to clear any filters when closing a spreadsheet Kevin Excel Discussion (Misc queries) 8 December 20th 07 06:05 PM
How to clear all filters in worksheet for all columns Helios Excel Discussion (Misc queries) 2 November 11th 07 11:19 PM
Auto Open - Clear all filters klm[_2_] Excel Programming 3 December 14th 05 09:00 PM


All times are GMT +1. The time now is 06:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"