Hi,
I'm new to this forum, i encountered an err.number = 5 when i tried to use GetAttr() on a file path. I used this GetAttr() in a For loop. I tried looking many places but msdn only mentions about error 52 and 53, no mention of 5 was found. Can anyone help? Is there any place where i can get a full list of error codes for GetAttr()?
Thanks! Below is my code for reference.
Peter
VB Code:
Public Function fnFindTargetComp(arrInTargetComp) As Boolean
Dim Filename$, i, res As Boolean
Dim vAttr
Err.Clear
On Error GoTo ErrorHandler
For i = 0 To UBound(arrInTargetComp)
Filename$ = "C:\FASIP\" & Trim$(arrInTargetComp(i)) & ".hex"
' Get the attributes and ensure that it isn't a directory
vAttr = GetAttr(Filename$)
fnFindTargetComp = ((vAttr And vbDirectory) <> vbDirectory)
dbg (Filename$)
Next i
Exit Function
ErrorHandler:
Select Case Err.Number
Case 52 ' Pathname is invalid or contains wildcards
MsgBox ("File :" & Filename$ & "has invalid pathname or contains wildcards.")
Case 53 ' Target file does not exist
MsgBox ("File :" & Filename$ & "does not exist.")
Case Else
MsgBox ("File : Unknown error")
End Select
End Function