Editting Axis Titles in Excel Charts

ddepencier

New member
Joined
Jul 20, 2009
Messages
1
Programming Experience
1-3
Hi All,

I've been struggling for hours trying to get a title on the secondary axis of an Excel Chart. The directions I am getting from other forums are not working. Has anyone dealt with this before? Here is the code I am currently using.

xlAxisValue = CType(tTChart.Axes(, Microsoft.Office.Interop.Excel.XlAxisGroup.xlPrimary), Excel.Axes)
xlAxisValue.Item(Microsoft.Office.Interop.Excel.XlAxisType.xlValue).HasTitle = True
xlAxisValue.Item(Microsoft.Office.Interop.Excel.XlAxisType.xlValue).AxisTitle.Characters.Text = "Travel Time (s)"
xlAxisValue.Item(Microsoft.Office.Interop.Excel.XlAxisType.xlValue)
xlAxisValue = CType(tTChart.Axes(, Microsoft.Office.Interop.Excel.XlAxisGroup.xlSecondary), Excel.Axes)
xlAxisValue.Item(Microsoft.Office.Interop.Excel.XlAxisType.xlValue).HasTitle = True
xlAxisValue.Item(Microsoft.Office.Interop.Excel.XlAxisType.xlValue).AxisTitle.Characters.Text = "Travel Speed (mph)"
xlAxisCategory = CType(tTChart.Axes(, Microsoft.Office.Interop.Excel.XlAxisGroup.xlSecondary), Excel.Axes)
xlAxisCategory.Item(Microsoft.Office.Interop.Excel.XlAxisType.xlCategory).TickLabels.NumberFormat = "MM/DD/YY" & vbCrLf & "HH:MM:SS"
xlAxisCategory.Item(Microsoft.Office.Interop.Excel.XlAxisType.xlCategory).TickLabelPosition = Microsoft.Office.Interop.Excel.XlTickLabelPosition.xlTickLabelPositionLow

The title property of xlAxisSecondary keeps overwriting the title of xlAxisValue and leaving the secondary axis title blank.

Thanks!
 
Back
Top