Microsoft KB Archive/78917

{|
 * width="100%"|

-

The information in this article applies to:


 * Microsoft Excel for Windows, versions 3.0, 4.0
 * Microsoft Excel for OS/2, version 3.0

-

SUMMARY
If you are attempting to make modifications to an embedded chart in Microsoft Excel from within a macro, the macro may halt with an error message if you have previously edited the chart. The problem occurs if you have not closed or hidden the chart window after making the previous modifications.

MORE INFORMATION
To modify an embedded chart from within a macro, you must first execute the UNHIDE function on the chart to display the editable chart window. To then return to the embedded chart, you should either close or hide the separate chart window. This makes it possible to unhide and make further changes to the chart the next time the macro is called.

The following macro would convert an embedded chart (of any type) to a line chart:

  =UNHIDE(&quot;Sheet1 Chart 1&quot;) =GALLERY.LINE(3,TRUE) =ACTIVATE(&quot;Sheet1&quot;) =RETURN This macro does not close the chart window that was activated with the UNHIDE function. It simply brings the original worksheet to the foreground so that the chart window is no longer visible. Subsequent attempts to execute the UNHIDE function, as shown above, result in a macro error because the chart is not a hidden window.

To modify the chart a second time after running the macro shown above, issue the command =ACTIVATE(&quot;Sheet1 Chart 1&quot;), or modify the macro shown above by replacing the =ACTIVATE(&quot;Sheet1&quot;) with either =HIDE or =CLOSE. Either method works equally well.