Activating an Embedded Chart Using a MacroLast reviewed: September 2, 1997Article ID: Q71539 |
The information in this article applies to:
SUMMARYYou can create an embedded chart object using the chart tool on the Standard Toolbar. You must create an embedded chart in the instance of Microsoft Excel that contains the supporting data. The embedded chart is then dynamically linked to this data. To add a legend, title, etc. to your embedded chart, you must activate the chart object. You can do this by double-clicking anywhere on the chart object. In Microsoft Excel version 5.0, when you activate an embedded chart, a hatched border appears around the chart and you can format the chart elements. In Microsoft Excel versions 3.0 and 4.0, when you activate an embedded chart, a copy of the chart object opens in a new window. This new window displays the chart menu bar, allowing you to format the chart elements. The embedded chart on the worksheet immediately reflects all changes made to the copy in the window. You can also activate an embedded chart object using a macro as in the following examples:
Microsoft Excel version 5.0 Visual Basic Example
' Dimension variable Dim Data As String ' Assign variable Data to selected cells Data = Selection.Address ' Create embedded chart from selected data ActiveSheet.ChartObjects.Add(82.8, 76.8, 321.6, 100.2).Select ActiveChart.ChartWizard Source:=Range(Data) ' Activate embedded chart for editing Selection.ActivateMicrosoft 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. Note that a line that is preceded by an apostrophe introduces a comment in the code--comments are provided to explain what the code is doing at a particular point in the procedure. Note also that an underscore character (_) indicates that code continues from one line to the next. You can type lines that contain this character as one logical line or you can divide the lines of code and include the line continuation character. For more information about Visual Basic for Applications programming style, see the "Programming Style in This Manual" section in the "Document Conventions" section of the "Visual Basic User's Guide."
Microsoft Excel versions 3.0 and 4.0 Macro
A1: =COPY() A2: =CREATE.OBJECT(5,!$B$5,5,5,!$D$15,5,5) A3: =DEFINE.NAME("Temp") A4: =GET.NAME("!Temp") A5: worksheet=GET.DOCUMENT(1) A6: =UNHIDE(worksheet&" "&A2) A7: =RETURN()This macro does the following:
REFERENCES"User's Guide," version 4.0, page 394-399, 435 "User's Guide," version 3.0, page 325, 391-394 "Function Reference," version 4.0, pages 65-66, 77-79, 196, 201, 441 "Function Reference," version 3.0, pages 36, 40, 107, 111, 241
|
Additional query words: 7.00 3.0 3.00 4.0 4.00 5.0 5.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |