Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting error trying to set Filters with Application.FileDialog

Status
Not open for further replies.

SBendBuckeye

Programmer
May 22, 2002
2,166
US
Hello All,

I am getting Error 438 - "Object doesn't support this property or method" when trying to set the Filters property when setting up the Application.FileDialog object. I get the error even when using code I copied and pasted right out of the Help example. Everything else is working perfectly. Below is my code with some other properties which are working included. The problem parts are in red. It is part of a function named PopRequestedDialog.

Thanks in advance for any help, ideas and/or suggestions!

Code:
With Application.FileDialog(DialogType)
  If Not IsMissing(TitleText) Then
    .Title = Trim$(TitleText)
  End If
  If Not IsMissing(InitialFileName) Then
    .InitialFileName = InitialFileName
  End If

  'Clear last set of filters
  .Filters.Clear
[COLOR=red]
  'This is a copy and paste right out of Help
  .Filters.Add Description:="All files", _
               Extensions:="*.*"

  'Also a copy and paste right out of Help
  'Add a filter that includes GIF and JPEG
  'images and make it first item in the list
  .Filters.Add "Images", _
               "*.gif; *.jpg; *.jpeg", 1
[/color]   
  If Not IsMissing(FilterIndex) Then
    .FilterIndex = FilterIndex
  End If
  .AllowMultiSelect = AllowMultiSelect
  If .Show Then
    PopRequestedDialog = True
    Set SelectedItems = .SelectedItems
  Else
    'User pressed Cancel
    PopRequestedDialog = False
  End If
End With

Have a great day!

j2consulting@yahoo.com
 
Looks like it should work to me; the MSDN article omits the param names, have you tried it like that?
Code:
      .Filters.Add "Access Databases", "*.MDB"
      .Filters.Add "Access Projects", "*.ADP"
      .Filters.Add "All Files", "*.*"


VBSlammer
redinvader3walking.gif

[sleeping]Unemployed in Houston, Texas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top