Invalid Procedure Call/Argument

C

Craig

I'm using Access XP. I have a common routine that I'm using to obtain file
names from a directory that the user selects from an API call, and that
populates a global variable called 'sDirectory'. My code is below. I get
the "Invalid Procedure Call or Argument" error dialog box at the ".FileType =
msoFileTypeAllFiles" line (Also, I do have the Microsoft Access 11 Object
Library reference checked):

'-------------------------------------------------------
On Error GoTo errhandler
Dim fs, filespec, m, X
Dim j As Integer
Dim Count As Integer
Dim nbrFiles As Long
'
Count = 0
'
If sdirectory <> "" Then
With Application.FileSearch
.NewSearch
.LookIn = sdirectory
.FileType = msoFileTypeAllFiles
.Filename = "JPEG|*.jpg|TIF|*.tif|JPG|*.jpg|BMP|*.bmp|GIF|*.gif"
.SearchSubFolders = True
.Execute (msoSortByFileName)
MsgBox "Number files: " & .FoundFiles.Count
End With
Else
Exit Sub
End If
'
MsgBox "Done."
Exit Sub
'
errhandler:
MsgBox Err.Description
'-------------------------------------------------------

Thanks for any and all help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top