+ Reply to Thread
Results 1 to 5 of 5

Excel 2003 disliking an old sheet's basic commands

  1. #1
    Registered User
    Join Date
    07-14-2006
    Posts
    24

    Excel 2003 disliking an old sheet's basic commands

    Hi all

    I recently dug up a 2-year-old spreadsheet script of mine, written 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, a peculiar error appears.

    After a certain point in the code, any VB calls to the spreadsheet fail. this includes all cell reading, writing, chart selection the lot. Any interaction, it seems, returns the 'Application-defined or Object-defined' error. The point at which this error starts to appear is when an add-in object that issues callbacks is activated - the 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 of sorts. I'm a little hazy on how it works tbh).

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

  2. #2
    Jim Thomlinson
    Guest

    RE: Excel 2003 disliking an old sheet's basic commands

    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...
    --
    HTH...

    Jim Thomlinson


    "F*SH" wrote:

    >
    > Hi all
    >
    > I recently dug up a 2-year-old spreadsheet script of mine, written
    > 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, a
    > peculiar error appears.
    >
    > After a certain point in the code, any VB calls to the spreadsheet
    > fail. this includes all cell reading, writing, chart selection the lot.
    > Any interaction, it seems, returns the 'Application-defined or
    > Object-defined' error. The point at which this error starts to appear
    > is when an add-in object that issues callbacks is activated - the
    > 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 of
    > sorts. I'm a little hazy on how it works tbh).
    >
    > A slightly vague question, perhaps, but I'm told this is a common issue
    > (that said, it's not appearing in my searches). I would blame the add-in
    > object if it weren't for the fact this script works perfectly in XL2000.
    > Any ideas?
    >
    >
    > --
    > F*SH
    > ------------------------------------------------------------------------
    > F*SH's Profile: http://www.excelforum.com/member.php...o&userid=36355
    > View this thread: http://www.excelforum.com/showthread...hreadid=565189
    >
    >


  3. #3
    NickHK
    Guest

    Re: Excel 2003 disliking an old sheet's basic commands

    Is this relevant ?
    http://support.microsoft.com/?scid=k...512&sid=global

    NickHK

    "F*SH" <[email protected]> ¼¶¼g©ó¶l¥ó·s»D:[email protected]...
    >
    > Hi all
    >
    > I recently dug up a 2-year-old spreadsheet script of mine, written
    > 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, a
    > peculiar error appears.
    >
    > After a certain point in the code, any VB calls to the spreadsheet
    > fail. this includes all cell reading, writing, chart selection the lot.
    > Any interaction, it seems, returns the 'Application-defined or
    > Object-defined' error. The point at which this error starts to appear
    > is when an add-in object that issues callbacks is activated - the
    > 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 of
    > sorts. I'm a little hazy on how it works tbh).
    >
    > A slightly vague question, perhaps, but I'm told this is a common issue
    > (that said, it's not appearing in my searches). I would blame the add-in
    > object if it weren't for the fact this script works perfectly in XL2000.
    > Any ideas?
    >
    >
    > --
    > F*SH
    > ------------------------------------------------------------------------
    > F*SH's Profile:
    > http://www.excelforum.com/member.php...o&userid=36355
    > View this thread: http://www.excelforum.com/showthread...hreadid=565189
    >




  4. #4
    Registered User
    Join Date
    07-14-2006
    Posts
    24
    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

  5. #5
    Registered User
    Join Date
    07-14-2006
    Posts
    24
    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?

    Search the error code (50290) returns quite a few people with the same problem, but no solutions. This topic's OP describes the exact same problem I'm having, but does a better job of it :D
    http://www.dbforums.com/showthread.php?t=535919
    Last edited by F*SH; 07-27-2006 at 05:50 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1