Excel: Macro Error when Adjusting an Embedded Chart

ID: Q78917


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("Sheet1 Chart 1")
   =GALLERY.LINE(3,TRUE)
   =ACTIVATE("Sheet1")
   =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("Sheet1 Chart 1"), or modify the macro shown above by replacing the =ACTIVATE("Sheet1") with either =HIDE() or =CLOSE(). Either method works equally well.


REFERENCES

"Microsoft Excel Function Reference," version 3.0, page 241

"Microsoft Excel User's Guide," version 3.0, pages 391-394

Additional query words: 4.0

Keywords :
Version : WINDOWS:3.0,4.0; :3.0
Platform : WINDOWS
Issue type :


Last Reviewed: October 21, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.