T
Thief_
I've got the following code:
Charts.Add
Set NewChart = Charts.Add
NewChart.ChartType = xlLineMarkers
NewChart.SetSourceData Source:=rng2Plot, PlotBy:=xlRows
NewChart.Location Where:=xlLocationAsObject, Name:="GraphResults"
With NewChart
.HasTitle = True
.ChartTitle.Characters.Text = Title
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Date"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Num Errors"
End With
The code fails at the line ".HasTitle = True". Viewing the NewChart object
in the Watch window show the object has NO properties, but I don't
understand why since it is dimmed as a chart object. The only way to make
this code work is to change it to:
Charts.Add
Set NewChart = ActiveChart
NewChart.ChartType = xlLineMarkers
NewChart.SetSourceData Source:=rng2Plot, PlotBy:=xlRows
NewChart.Location Where:=xlLocationAsObject, Name:="GraphResults"
With NewChart
.HasTitle = True
.ChartTitle.Characters.Text = Title
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Date"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Num Errors"
End With
Can someone explain why this is so?
Charts.Add
Set NewChart = Charts.Add
NewChart.ChartType = xlLineMarkers
NewChart.SetSourceData Source:=rng2Plot, PlotBy:=xlRows
NewChart.Location Where:=xlLocationAsObject, Name:="GraphResults"
With NewChart
.HasTitle = True
.ChartTitle.Characters.Text = Title
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Date"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Num Errors"
End With
The code fails at the line ".HasTitle = True". Viewing the NewChart object
in the Watch window show the object has NO properties, but I don't
understand why since it is dimmed as a chart object. The only way to make
this code work is to change it to:
Charts.Add
Set NewChart = ActiveChart
NewChart.ChartType = xlLineMarkers
NewChart.SetSourceData Source:=rng2Plot, PlotBy:=xlRows
NewChart.Location Where:=xlLocationAsObject, Name:="GraphResults"
With NewChart
.HasTitle = True
.ChartTitle.Characters.Text = Title
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Date"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Num Errors"
End With
Can someone explain why this is so?