Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Silicon Valley, California, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VB, Shapes on Chart (2000 SR1)

    Hi Folks,

    A couple questions: The Controls toolbar is all grayed-out, except the Design Mode and Properties buttons, when the active sheet is a Chart. This means, I can't put an ActiveX label on a chart. Is there something I'm missing here?

    Meanwhile: I put a label from the Forms toolbar on instead. I tried to change the text via VB code, but that only works if it is selected (through code) first. For example:

    <pre>Charts("Chart1").Activate
    Charts("Chart1").Shapes("Label 1").Characters.Text = "Howdy"
    </pre>


    does not work ("Object does not support this property or method"), but this does:

    <pre>Charts("Chart1").Activate
    Charts("Chart1").Shapes("Label 1").Select
    Selection.Characters.Text = "Howdy"
    </pre>


    However, after running this code, the label is selected. Is it possible to de-select it without explicitly selecting some other select-able object? For example, I can click with my mouse on the area between the Chart Area and the edge of the Excel window, the label will no longer be selected and nothing else will be selected in its place. However, such an action is not captured when recording. The best I can do is select something less obvious, like the Chart Area:

    <pre>.ChartArea.Select
    </pre>


    Any suggestions? Thanks!

  2. #2
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Kortrijk, Belgium
    Posts
    571
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VB, Shapes on Chart (2000 SR1)

    I can only confirm all your statements, based on my experience with shapes on charts. Maybe one small thing to add: if you press ctrl and then select the chart with the mouse, the squares on the chart border are open squares. Then you can select the upper left textbox to change the charts name, which is handy if you want to refer to the chart using its name in VBA. Or you can select the chart and run the following VBA statement to change the chart's name:

    ActiveSheet.Shapes(ActiveChart.Parent.Name).Name = "MyChart"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •