Location Object Example

The following example sets the title location for a chart using the Location object. To try the example, draw an MSChart and a ComboBox control on a form. Paste the code into the Form object's code module, and run the project. Click the ComboBox to change the title location.

Option Explicit

Private Sub Combo1_Click()
   MSChart1.Title.Location.LocationType = Combo1.ListIndex
End Sub

Private Sub Form_Load()
   ' Set Title Text.
   With MSChart1
      .TitleText = "Test Title Location"
      .Title.Location.Visible = True
   End With

   ' Add LocationType constants to ComboBox.
   With Combo1
      .AddItem "VtChLocationTypeTopLeft"     ' 0
      .AddItem "VtChLocationTypeTop"         ' 1
      .AddItem "VtChLocationTypeTopRight"    ' 2
      .AddItem "VtChLocationTypeLeft"        ' 3
      .AddItem "VtChLocationTypeRight"       ' 4
      .AddItem "VtChLocationTypeBottomLeft"  ' 5
      .AddItem "VtChLocationTypeBottom"      ' 6
      .AddItem "VtChLocationTypeBottomRight" ' 7
      .AddItem "VtChLocationTypeCustom"      ' 8
      .ListIndex = 0
   End With
End Sub