Linker IT Software
Google
Web www.oraxcel.com
menubar-top-links menubar-top-rechts
Home Help Search Login
Welcome, Guest. Please Login.
SQL*XL: Database to Excel bridge litLIB: Excel power functions pack ExcelLock: Locking and securing your valuable Excel spreadsheets encOffice: Protect your Excel file easy and safe encOffice: Protect your Excel file easy and safe
Pages: 1
Error trapping... (Read 5551 times)
grahamf
YaBB Newbies
*


I Love SQL*XL

Posts: 13
Error trapping...
15.03.07 at 11:27:36
 
It seems that SQL*XL doesn't RAISE  errors in the regular VBA way, i.e. code wrapped in On error .... still executes your internal trapping - rather than the code I want to execute. - 2 questions / options
(a) How can I make it behave like regular VBA and/or
(b) How can I replace your contact details / email address with mine, so my programming errors get reported to me rather than you.
 
Thanks
Graham
Back to top
 
 
  IP Logged
Gerrit-Jan Linker
YaBB Administrator
*****




Posts: 75
Re: Error trapping...
Reply #1 - 15.03.07 at 19:41:27
 
SQL*XL traps the errors in the normal way. All errors are trapped in an On error statement internally. They are dispatched to a central error handler that hooks into the automated error reporting facility if an error occurs that is not trapped.
 
At the moment you cannot switch this error trapping off. You can set SQL*XL such that the errors do not display. They will still happen and they will still be trapped. The only thing is that the messages are not displayed.
 
You can suppress the SQL*XL error messages by putting the following code in your macro:
 
SQLXL.litErr.DisplayErrors = False
 
When an error occurs a general message is displayed with the error details. The user is asked whether the error should be reported. If the user chooses yes, a html page will be shown with the error details. Submitting the form will indeed send the error to us.
 
If you would like to let the errorhandler send the error to you, look for the file ts.tpl in your windows system32 directory. This is a template html file. Rename the file to .html and edit it. You can change the page to let the form be sent to you instead.
 
Now I write this I realise that windows XP SP2 and windows Vista users will have a problem when the error reporting tries to report the fault to us. The ts.tpl file will be used to create a new ts.html file. That file will be created in the same directory as the ts.tpl file and that will be c:\windows\system32 by default. I need to change that to create the ts.html file in the application data folder. I will make that change in version SQL*XL 4.1.13
 
If you would like to not suppress the error messages but to raise the errors to any calling application I can program that in for you.
Back to top
 
 

Gerrit-Jan Linker
Linker IT Software
Email WWW Gerrit-Jan Linker   IP Logged
Gerrit-Jan Linker
YaBB Administrator
*****




Posts: 75
Re: Error trapping...
Reply #2 - 15.03.07 at 20:00:39
 
I have added the following syntax in SQL*XL 4.1.13 to allow the re-raising of errors so you can trap them yourself in VBA:
 
SQLXL.LITErr.RaiseErrors = True
 
If you want to fully switch off the SQL*XL error reporting use:
 
SQLXL.LITErr.DisplayAlerts = False
SQLXL.LITErr.RaiseErrors = True

 
If you do want the SQL*XL error reporting as well use:
 
SQLXL.LITErr.DisplayAlerts = True
SQLXL.LITErr.RaiseErrors = True
Back to top
 
 

Gerrit-Jan Linker
Linker IT Software
Email WWW Gerrit-Jan Linker   IP Logged
Gerrit-Jan Linker
YaBB Administrator
*****




Posts: 75
Re: Error trapping...
Reply #3 - 16.03.07 at 13:13:33
 
Some further information about the SQL*XL error trapping mechanism:
 
When an error occurs a central error logger is invoked. First it will check whether it should display a message. If it displays the message you can opt to send the problem in. This uses the ts.tpl file which you can edit so the bug is reported to you instead of to me.
 
After this the software will log the error in the windows event log.
Then it will check whether you want to re-raise the error so you have the chance to catch the error in your own VBA software.
 
Note that I use the following rules for SQL*XL errors.
I will put the name of my source component in the Err.Source field. That can contain: litCommon, litADO, litSQLXL, etc. All sources prefixed lit are SQL*XL internally raised errors. The Err.Number is set vbObjectError + sequential number.
Back to top
 
 

Gerrit-Jan Linker
Linker IT Software
Email WWW Gerrit-Jan Linker   IP Logged
Pages: 1