PDA

View Full Version : Excel VBA Error Report



theta
04-13-2012, 09:06 AM
I have googled for a solution but cannot locate one.

I have macros running on machines that I do not have physical access to. When errors occur, I have to go to the machine to reproduce the issue and then investigate.

I would like to put together some VBA that will run on the local machines whenever the workbook is opened - recording all Debug and Error (trapped and untrapped) into a CSV file in a default file location e.g. C:\Windows\Errors.txt (or .csv)

People can then send me the error log and I can have a look and see what is going on...

Would also like it (if possible) to dump all variables and constants and their values at the end of this file if a full untrapped error occurs i.e. an End / Debug msgbox appears to the user

Any help appreciated ?

Bob Phillips
04-13-2012, 02:59 PM
You should NEVER get an End/Debug because you should have full and proper error handling. Your error handler could then dump the info you want.

theta
04-16-2012, 02:40 AM
What is the most efficient / user friendly ErrHandler code available? There is normally a well written solution to trap and handle all errors, report them to a file, add to a list box, print in immediate window etc... ?

Bob Phillips
04-16-2012, 06:54 AM
The important thing is to trap them. What you do with them depends upomn the application, but the minimal you should do is to put out a MsgBox so that the user knows something has happened.