0

I need to output all of the information on an error that has occured to a msgbox and a log text file. My current code only outputs a message that tells the user an error has occurred. I need actualy error information to be displayed in short in the msgbox and a more detailed explanation in a log file.

I would just like to add I am using TestPartner for this script and it uses VBScript as its language so the concepts are similar to those in VB6.

This is my code currently:

Private Sub CmdPOstart_Click()

errorcount = 0

On Error GoTo ErrorHandler

'Do stuff...

ErrorHandler:
    errorcount = errorcount + 1 'Add 1 to the error count
    'Output the error information to a msgbox
    MsgBox ("An Error Occurred! " & errorcount & " Errors ")
Exit Sub

End Sub

Thanks in advance.

3
  • I retagged and edited the question because VBScript is similar to VB6, but there are some important differences. Commented Aug 5, 2013 at 11:57
  • I suggest having a look at this answer and perhaps this answer for advice on how to log from VBScript Commented Aug 5, 2013 at 11:58
  • 2
    In fact, are you sure this is VBScript? On Error Goto is not supported in VBScript. This is an example of the important differences between VB6 and VBScript that I mentioned above. Commented Aug 5, 2013 at 12:02

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.