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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Does not support" Application.FileSearch

Status
Not open for further replies.

metamind

Programmer
Jul 15, 2004
20
GB
I copied a block of code over from an excel macro into a visio macro and I get a "Run-time error '438': Object doesn't support this property or method". The block of code is below:

Code:
        With Application.FileSearch
            .NewSearch
            .LookIn = dir
            .SearchSubFolders = False
            .filename = "*.xml"
            If .Execute > 0 Then
                For i = 1 To .FoundFiles.count
                    Call fileCollection.Add(.FoundFiles(i))
                Next i
                Set getFileList = fileOperator.selectHighestFileVersions(fileCollection)
            Else
                'MsgBox "There were no files found."
            End If
        End With

it failed on the Application.FileSearch

Any ideas?

Thanks in advance.
 
The Visio Application object doesn't have a FileSearch method. Although each Automation application has many properties and methods in common, there are many more that are application-specific. You can always use the Dir command and parse your structure recursively

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

For tsunami relief donations

'If we're supposed to work in Hex, why have we only got A fingers?'

for steam enthusiasts
 
Thanks johnwm. I suspected as much (even though FileSearch is in visio's VB help). I ended up using:

Code:
        Dim fs, f, f1, fc, s
        Set fs = CreateObject("Scripting.FileSystemObject")
        Set f = fs.GetFolder(dir)
        Set fc = f.files
        For Each f1 In fc
            Call fileCollection.Add(f1.name)
        Next

in the end.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top