Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

29 views
Skip to first unread message

ememcee <>

unread,
Feb 24, 2004, 1:03:30 PM2/24/04
to
I had this exact error happen to me this week, and found it rather
frustrating to say the least. Reading this thread at least made it
clear that it is a known MS problem. I also could not find any English
version of the above mentioned MS KB article, but I do have a Japanese
technical contact who kindly sent me a translation. Here it is:
================================

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

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

Solution is to check the Ready property to run your code only when
Excel is ready for automation communication. This property is newly
available with Excel 2002. Here's a sample program on how to use the
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 for
processing.

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

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

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

======================


---
Message posted from http://www.ExcelForum.com/

0 new messages