The information in this article applies to:
SYMPTOMSIn Microsoft Excel, if you use a Visual Basic macro to create a Microsoft Office Binder OLE Automation object, you may receive an Illegal Operation error in Microsoft Excel. If you click Details, you may see information similar to the following:
CAUSEThis problem occurs if you create an Office Binder OLE Automation object, and you add a Microsoft Excel worksheet section to the Binder without dimensioning the Microsoft Excel section as an object to hold a pointer in memory for the object. For example, when you run the following macro, you receive an Illegal Operation error in Microsoft Excel:
When you run the macro above, the myBinder.sections.Add statement correctly
adds a worksheet section to the Binder. However, there is no pointer in
memory for this object. The first reference to this section object occurs
without an error, but the second reference to this object causes Microsoft
Excel to crash.
Note that the above example is not the only example that causes an Illegal Operation error in Microsoft Excel. Other examples may include commands similar to the following:
WORKAROUNDTo work around this behavior, when you add a Microsoft Excel worksheet section to a Binder using OLE Automation, dimension the worksheet section as Object type add so that a pointer in memory is reserved for this object. For example, to run the above macro without receiving an Illegal Operation error, modify the macro as follows:
Microsoft provides examples of Visual Basic procedures for illustration
only, without warranty either expressed or implied, including but not
limited to the implied warranties of merchantability and/or fitness for a
particular purpose. This Visual Basic procedure is provided 'as is' and
Microsoft does not guarantee that it can be used in all situations.
Microsoft does not support modifications of this procedure to suit customer
requirements for a particular purpose.
STATUS
Microsoft has confirmed this to be a problem in the Microsoft products
listed at the beginning of this article. We are researching this problem
and will post new information here in the Microsoft Knowledge Base as it
becomes available.
REFERENCESFor more information about communicating with other applications in Microsoft Excel, click the Index tab in Microsoft Excel Help, type the following text CreateObject functiondouble-click the selected text, and then double-click "communicating with other applications" to go to the "Communicating With Other Applications" topic. Additional query words: xl7 gpf crash
Keywords : offwin |
Last Reviewed: June 3, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |