L
Lee
The following code fails to compile in Excel 2003 because it uses methods
that are new to Excel 2007. Is there any way around this problem or do I
need to create a separate program for Excel 2003 and 2007?
'The code to add a tile for the chart and axes is different for Excel
2003 and 2007
If Application.Version = "11.0" Then
With ActiveChart
'Excel 2003 code
.HasTitle = True
.ChartTitle.Characters.Text = strTitle + Chr(10) + strSubTitle
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text =
strXAxis
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = strYAxis
End With
ElseIf Application.Version = "12.0" Then
With ActiveChart
'Excel 2007 code
.SetElement (msoElementChartTitleAboveChart)
.ChartTitle.Text = strTitle + Chr(10) + strSubTitle
.SetElement (msoElementPrimaryCategoryAxisTitleAdjacentToAxis)
.Axes(xlCategory, xlPrimary).AxisTitle.Text = strXAxis
.SetElement (msoElementPrimaryValueAxisTitleRotated)
.Axes(xlValue, xlPrimary).AxisTitle.Text = "y-axis stryaxis"
End With
End If
that are new to Excel 2007. Is there any way around this problem or do I
need to create a separate program for Excel 2003 and 2007?
'The code to add a tile for the chart and axes is different for Excel
2003 and 2007
If Application.Version = "11.0" Then
With ActiveChart
'Excel 2003 code
.HasTitle = True
.ChartTitle.Characters.Text = strTitle + Chr(10) + strSubTitle
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text =
strXAxis
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = strYAxis
End With
ElseIf Application.Version = "12.0" Then
With ActiveChart
'Excel 2007 code
.SetElement (msoElementChartTitleAboveChart)
.ChartTitle.Text = strTitle + Chr(10) + strSubTitle
.SetElement (msoElementPrimaryCategoryAxisTitleAdjacentToAxis)
.Axes(xlCategory, xlPrimary).AxisTitle.Text = strXAxis
.SetElement (msoElementPrimaryValueAxisTitleRotated)
.Axes(xlValue, xlPrimary).AxisTitle.Text = "y-axis stryaxis"
End With
End If