Error 50290: Error writing to Worksheet while using an ActiveX Control

Discussion in 'Microsoft Excel Programming' started by emblair3, Oct 30, 2003.

  1. emblair3

    emblair3 Guest

    Has anyone ever encountered error 50290 ("Application
    defined or object defined error") when trying to write to
    a worksheet containing a 3rd party ActiveX Control?
    (i.e., The line 'Worksheets("Sheet1").Range("A1").Value =
    1' causes an error.) This error seems to occur
    ocassionally and spontaneously. I have tried everything,
    but I know I'm not alone. (Search Google for Excel Error
    50290 and you'll find several hits - but no solutions.)
    Thanks in advance.
    emblair3, Oct 30, 2003
    1. Advertisements

  2. emblair3

    Fred Guest

    I also ran into this problem lately, I haven't find a
    solution yet, but I found something in the Microsoft
    Knowledge Base about this;ja;820595

    The problem is this article is in Japanese, and I cannot
    find the same article under the English version and I
    don't read Japanese either. Hopefully someone can help,
    thanks in advance.

    Fred, Oct 30, 2003
    1. Advertisements

  3. emblair3

    Edward Blair Guest

    Aaah, Microsoft. Post a solution, but do it in Japanese. God love ya.

    I 'fished your page ( but the
    translation is, um, difficult to understand. Imagine Yoda providing
    MSFT tech support.

    I have discovered that if you wait for a random amount of time and try
    again, this error mysteriously goes away. (I do this by using On Error
    Exit Sub in my WriteToWorkSheet sub.) You obviously miss whatever data
    was happening during that period of time, but at least your code doesn't
    Edward Blair, Nov 3, 2003
  4. emblair3

    ememcee Guest

    I had this exact error happen to me this week, and found it rathe
    frustrating to say the least. Reading this thread at least made i
    clear that it is a known MS problem. I also could not find any Englis
    version of the above mentioned MS KB article, but I do have a Japanes
    technical contact who kindly sent me a translation. Here it is:

    The run-time error 50290 could occur when executing an Excel macr
    created by Excel 2000 or an earlier version on Excel 2002. This i
    because of a specification change of automation processing in Exce

    When an automation related method is called, or when an automatio
    related property is set, Excel 2002, as an automation server, firs
    checks whether Excel is doing another processing such as handling dat
    input by user. In case of a program that handles some events durin
    communication with an external component such as ActiveX Control, Exce
    can sometimes be unavailable temporarily. If automation communicatio
    is requested at this timing, Excel will return this run-time error.

    Solution is to check the Ready property to run your code only whe
    Excel is ready for automation communication. This property is newl
    available with Excel 2002. Here's a sample program on how to use th
    Ready property.

    'When Excel version is 2002 or later
    If Val(Application.Version) >= 10 Then

    'Check the application status to see if it is available fo

    If Application.Ready = True Then
    <Describe what you want to do here>
    End If

    'When Excel version is 2000 or earlier, continue the processing
    <Describe what you want to do here>
    End If

    Note 1: There is no way to know at what timing the Ready property ca
    become false. When you run a program that makes some events happe
    during communication with an external component, it is recommended tha
    you add a statement to make sure the Ready property is true.
    Note 2: The sample program above will not do anything when the Read
    property is false. If you want to force changing the value from fals
    to true, you need to add additional codes doing so, such as sending a
    Esc key by the Sendkeys statement.

    ememcee, Feb 24, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.