What is the best way of collectiong as much debug info as possible when users hit problems.

C

Chrisso

What is the best way to collect information about errors when my users
hit a problem so that I can solve them offline and remotely and let my
users continue?

I would really like more information than the Err object provides. Of
course, Err.Number & Err.Description are useful but I would really
need more information for proper debug such as the line of code that
threw the error ,call stack and current context (i.e. ActiveSheet etc
etc). Is this possible or is the Err object the limit of problem
description?

I figure if I could extract all this information I could have my error
handler mail the dump to me and let the user continue.

Does anyone have any ideas or web resources that discuss this issue?

Cheers for any thoughts in advance.

Chrisso
 
B

Bob Phillips

Chrisso,

Get hold of Professional Excel Development by Stephen Bullen, Rob Bovey and
John Green. It has an excellent chapter on centralised error management.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
S

Smallweed

I use a universal error handling function, e.g.

Function myErrorHandler(errno As Integer, errdescr as String, callingroutine
as String, activesht as String, etc, etc)
MsgBox errno & errdescr & callingroutine & activesht, etc

This can then be called from handingling section of each routine, e.g.
Sub myRoutine()
On Error Goto Handler
(code)
Exit Sub
Handler:
myErrorHandler Err.Number, Err.Description, "myRoutine", ActiveSheet, ...
End Sub

If you want to be a bit more clever than just showing a message box, you
could use the necessary automation code to bung it all into, say, an Outlook
email to you so the user doesn't even see the error.
 
N

NickHK

Also, whilst I see no mention of it in VBA help or the Object Browser, there
is the Erl function to return the line that errored.
You of need to have all you code lines numbered for this return anything but
0.
The MZ Tools add-in will prove useful for this:
http://www.mztools.com/index.htm

Private Sub CommandButton1_Click()
10 On Error GoTo handler
20 ActiveWorkbook.ConflictResolution = xlOtherSessionChanges

30 Exit Sub
handler:
40 Debug.Print Erl

End Sub

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top