The information in this article applies to:
SYMPTOMSWhen you use a macro to change a chart that is on a chart sheet to a chart object on a worksheet (or vice versa), you receive one of the following error messages:
-or- If you click Details, the following error message appears: If you click Close, Microsoft Excel closes. CAUSE
This problem occurs when you create a Visual Basic for Applications macro
and both of the following conditions are true:
WORKAROUNDMicrosoft provides programming examples 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 article assumes that you are familiar with the programming
language being demonstrated and the tools used to create and debug
procedures. Microsoft Support professionals can help explain the functionality
of a particular procedure, but they will not modify these examples to
provide added functionality or construct procedures to meet your specific
needs. If you have limited programming experience, you may want to contact
the Microsoft fee-based consulting line at (800) 936-5200. For more
information about the support options available from Microsoft, please see
the following page on the World Wide Web: http://www.microsoft.com/support/supportnet/overview/overview.asp To move a chart without receiving this error message, use either of the following methods. Method 1: Refer to the Chart as an ObjectAssign an object variable to the chart object each time it is moved. You must use this variable when you refer to the chart. For example, the following macro creates an embedded chart on Sheet1 using data on Sheet1 in the range A1:C4. The chart is moved to a new chart sheet and is then moved back to Sheet1. In the following example, each time the chart object is referenced, the variable X is set equal to the chart:
Method 2: Refer to the Chart as ActiveChartIf it is not necessary to assign an object variable to the chart, refer to the chart as ActiveChart. For example, the following macro statement uses the ActiveChart property and Location method to move a chart to a chart sheet named Chart1:
STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. MORE INFORMATIONYou can move a chart to a new location in Visual Basic for Applications by using the Location method. The first argument, Where, designates the location to which you want to move the chart. The valid locations and their associated XlChartLocation constants are listed in the following table.
REFERENCESFor more information about the Location method, in the Visual Basic Editor, click
Microsoft Visual Basic Help on the Help menu, type
Location Method in the Office Assistant or the Answer Wizard, and
then click Search to view the topic. Additional query words: gpf ipf ole automation XL2000
Keywords : kberrmsg kbprg kbdta kbchart xlvbainfo |
Last Reviewed: November 9, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |