-
error handler mistak
im writing an error handler for filing operation, but the problem is that the handler executes whether or not there was an error, here is da code
Code:
Private Sub Command1_Click()
Dim currentLine, id, pwd, arr
On Error GoTo errHandler
Open App.Path & "\info.txt" For Input As #1
Do Until EOF(1)
Line Input #1, currentLine
arr = Split(currentLine, "=")
If LCase(arr(0)) = "username" Then
id = arr(1)
ElseIf LCase(arr(0)) = "password" Then
pwd = arr(1)
Loop
MsgBox id & " " & pwd & " " & phone
errHandler:
MsgBox "File not verified"
End
End Sub
-
Re: error handler mistak
Add
ExitSub
before the errHandler: