Excel 2003 disliking an old sheet's basic commands

F

F*SH

Hi all

I recently dug up a 2-year-old spreadsheet script of mine, writte
originally in VBA for XL2000. It works fine if I run it under XL2000
but as soon as I try it with the next version of Excel, XL2003,
peculiar error appears.

After a certain point in the code, any VB calls to the spreadshee
fail. this includes all cell reading, writing, chart selection the lot
Any interaction, it seems, returns the 'Application-defined o
Object-defined' error. The point at which this error starts to appea
is when an add-in object that issues callbacks is activated - th
errors seem to stop when this object is deactived (I say 'activation'
this is when the object is set to listen for an external trigger o
sorts. I'm a little hazy on how it works tbh).

A slightly vague question, perhaps, but I'm told this is a common issu
(that said, it's not appearing in my searches). I would blame the add-i
object if it weren't for the fact this script works perfectly in XL2000
Any ideas
 
J

Jim Thomlinson

Your description is a little thin. This object that listens, I assume that
there is a class module and that somewhere in your code you create an
instance of that class (probably in the open event of ThisWorkbook)...
something like...

Set objXLEvents as New clsXLEvents

My guess is that somehow that object is being destroyed somehow while the
code is running. Perhaps an error handler is being triggered under 2003 that
is not being triggered under 2000. If anywhere in that error handler there is
a line of code "End" then all objects will be destroyed when that line
executes. Without seeng some code though it is hard to comment further...
 
F

F*SH

Thanks for the replies. I know I'm a little vague, it's a little
difficult to explain.

Most of my code is kosher and works a charm. There is one section,
where an object is created. You won't recognise it; it's internally
developed, but it is intantiated as so:
-Set hsdmConnection = New historical.Telemetry-
I bunch of parameters are set for -hsdmConnection-, and then one of
it's methods are called, which 'starts' the object. Until another
method to 'stop' it is called, the object listens to an external data
source and, when that data source changes, a third method is invoked
(so the data change can be imported to Excel and processed). While the
object is 'running', VB just stalls with a load of sleeps for a certain
time at which point the stop command is send. At no point the object is
destroyed while running, but I do remove it shortly after I issue a
stop command, when it is no longer needed.

The problem is is that, after the object is 'set running', I cannot
interact with the spreadsheet, even when it has stopped. Even basic
stuff, such as a range("X").value = ... these all return
object/application defined errors. It's almost as if the object is
'stealing' focus and not returning it and that any methods are being
invoked as if the scope was the -hsdmConnection -object. But I tried
adding 'Sheet1.range...', in an attempt to address it correctly, but it
didn't like it.

Probably still vague, and for that I apologise. But since this only
affects XL2003 and not XL2000, I think you are right in saying that
it's a line somewhere being differently executed. But all my code is
very basic, and nothing there 'dangerous'. No -ends- or anything. I've
stepped trhough, following each line, but nothing seems out of the
ordinary until, out of teh blue, a sheet interaction fails.

Nick: I can't see that being too relevant, but it might be. I can't
install it myself but I'll ask my admin to put it on for me..

Thanks
 
F

F*SH

Correction: reading cells can be done. Just trying to modify them the
causes problems. I can do this line:
-msgbox(range("A1").value) -
but not
-range("A1").value = "foo"
-
I guess this rules out any 'focus theft' and instead suggests that the
sheet is made read-only to VBA. Editing the spreadsheet in Excel works
fine while running. Any ideas what might cause this?
 
Top