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.
Public Function fnFindTargetComp(arrInTargetComp) As Boolean
Dim Filename$, i, res As Boolean
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)
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.")
MsgBox ("File : Unknown error")