Page 1 of 1 1
Topic Options
#180979 - 2007-09-29 08:18 PM Clearing an error?
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
I'm working on my xlLib UDF library, and noticed something odd.

In phase 1 of my test script, I exercise each of the functions in read and write mode, as appropriate. They all work as expected.

In phase 2, I use "bad" function parameters to verify the error handling and proper return codes.

During my test, I have an Excel workbook with two worksheets. I try to select worksheet 8 and, as expected, get an error. The problem is - any further function calls continue to return the same error, including valid calls! For example, after failing to select non-existant sheet 8, I can successfully select sheet 2 and then sheet 1, and finally delete sheet 2, but these three successful steps still return the error event from the invalid sheet selection. The error string is
COM exception error "WorkSheets" ((null) - (null)) [-2147352567/80020009]

Do I need to somehow clear the error after it occurs?

Thanks!

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#180981 - 2007-09-29 08:49 PM Re: Clearing an error? [Re: Glenn Barnas]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
Um - nevermind... I found that
 Code:
$oXL.err.reset

after the error resets the error and allows normal processing to continue.
The document I had read suggested using "err.clear", not "err.reset". "err.clear" did not work.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1376 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.051 seconds in which 0.024 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org