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

Invalid procedure call or agument on Dir function

Status
Not open for further replies.

rewdee

Programmer
Aug 17, 2001
295
US
The code is nearly identical to that from the help file
but I'm getting an Invalid procedure call or argument
(error number 5) when I'm iterating through directories
with this code:
=========================================================
Code:
MyPath = sFileStart
'Retrieve the first entry.
MyName = Dir(MyPath, vbDirectory)
Do While MyName <> &quot;&quot;    
    If MyName <> &quot;.&quot; And MyName <> &quot;..&quot; Then        
        If (GetAttr(MyPath & MyName) And vbDirectory) = 
vbDirectory Then
            AddFolder lngShareID, lngPrtID, MyName, sPath, 
sMask
        End If
    End If
    MyName = Dir ' Get next entry.
Loop
=========================================================
Where AddFolder is a procedure but the exception occurs in
the calling Dir function to get the next directory
(MyName=Dir). Does anyone have any ideas why this
exception is occurring and any workarounds?

Thanks
Bill N
 
Thanks John for the reply but I still get the error.

Rewdee
 
Oops, I figured it out. You are right John, An error is occuring in a procedure in AddFolder(which adds the name of the folder and its parent to a table). There is no error handling hence the error is being raised in my FindFolders routine.

Thanks,
Rewdee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top