Invalid procedure call or argument on Dir functioon 
Author Message
 Invalid procedure call or argument on Dir functioon

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:
=========================================================
MyPath = sFileStart
'Retrieve the first entry.
MyName = Dir(MyPath, vbDirectory)
Do While MyName <> ""    
    If MyName <> "." And MyName <> ".." 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



Tue, 10 Aug 2004 20:38:50 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Error 5 Invalid Procedure call or argument

2. VBA: Filecopy invalid procedure call or argument on Win NT workstation

3. Invalid Procedure Call or Argument

4. Invalid procedure call or argument

5. Invalid Procedure call or argument [HTMLProject]

6. compile error "invalid procedure call or argument

7. Run-time error '5': Invalid procedure call or argument

8. Run-time error '5': Invalid procedure call or argument

9. Invalid procedure call or argument on Form.SetFocus

10. Invalid procedure call or argument: 'mid'

11. Function Error: Invalid procedure call or argument

12. Invalid Procedure Call or Argument

 

 
Powered by phpBB® Forum Software