akohan
asked on
Chart question using xl3DColumn constant.
Hello group,
In the following code; during runtime whenever I choose the third item from the
array (ar_ChartFormat(3) = xl3DColumn) and I look at the log file I can see "type : -4100" but the rest of the options are logged as normal values such as 51,53 and ... In fact, this causes mismatch type for the generated chart.
I'm using same constant value but on this specific item I'm having problem! What is the problem here?
Code:
ar_ChartFormat(1) = xlColumnClustered
ar_ChartFormat(2) = xl3DColumnClustered
ar_ChartFormat(3) = xl3DColumn
ar_ChartFormat(4) = xlColumnStacked
ar_ChartFormat(5) = xl3DColumnStacked
ar_ChartFormat(6) = xlColumnStacked100
ar_ChartFormat(7) = xl3DColumnStacked100
ar_ChartFormat(8) = xlLine
ar_ChartFormat(9) = xlLineMarkers
ar_ChartFormat(10) = xl3DLine
ar_ChartFormat(11) = xlLineStacked
ar_ChartFormat(12) = xlLineMarkersStacked
ar_ChartFormat(13) = xlLineStacked100
ar_ChartFormat(14) = xlLineMarkersStacked100
ar_ChartFormat(15) = xlPie
ar_ChartFormat(16) = xlPieExploded
ar_ChartFormat(17) = xl3DPie
ar_ChartFormat(18) = xl3DPieExploded
ar_ChartFormat(19) = xlPieOfPie
ar_ChartFormat(20) = xlBarOfPie
With ActiveSheet.ChartObjects.A dd(Left:=1 00, Width:=375, Top:=75, Height:=225)
.Chart.SetSourceData Source:=ActiveSheet.Range( strSelecte dRange)
LogInformation ("type: " & CStr(ar_ChartFormat(CInt(t vCtrlChart Type.Selec tedItem.In dex - 3))))
.Chart.ChartType = ar_ChartFormat(CInt(tvCtrl ChartType. SelectedIt em.Index - 3))
End With
regards,
ak
In the following code; during runtime whenever I choose the third item from the
array (ar_ChartFormat(3) = xl3DColumn) and I look at the log file I can see "type : -4100" but the rest of the options are logged as normal values such as 51,53 and ... In fact, this causes mismatch type for the generated chart.
I'm using same constant value but on this specific item I'm having problem! What is the problem here?
Code:
ar_ChartFormat(1) = xlColumnClustered
ar_ChartFormat(2) = xl3DColumnClustered
ar_ChartFormat(3) = xl3DColumn
ar_ChartFormat(4) = xlColumnStacked
ar_ChartFormat(5) = xl3DColumnStacked
ar_ChartFormat(6) = xlColumnStacked100
ar_ChartFormat(7) = xl3DColumnStacked100
ar_ChartFormat(8) = xlLine
ar_ChartFormat(9) = xlLineMarkers
ar_ChartFormat(10) = xl3DLine
ar_ChartFormat(11) = xlLineStacked
ar_ChartFormat(12) = xlLineMarkersStacked
ar_ChartFormat(13) = xlLineStacked100
ar_ChartFormat(14) = xlLineMarkersStacked100
ar_ChartFormat(15) = xlPie
ar_ChartFormat(16) = xlPieExploded
ar_ChartFormat(17) = xl3DPie
ar_ChartFormat(18) = xl3DPieExploded
ar_ChartFormat(19) = xlPieOfPie
ar_ChartFormat(20) = xlBarOfPie
With ActiveSheet.ChartObjects.A
.Chart.SetSourceData Source:=ActiveSheet.Range(
LogInformation ("type: " & CStr(ar_ChartFormat(CInt(t
.Chart.ChartType = ar_ChartFormat(CInt(tvCtrl
End With
regards,
ak
That would imply that you do not have a chart activated.
ASKER
Would you please explain what you mean?
As far as I know DSELECT method belongs to Chart class. So it shouldn't cause a problem.
Also as soon as a chart is plotted or created, I can see that it is selected (at least by seeing the frame around it and small boxes on each side).
regards,
ak
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok. I found the cause. After a chart is created on worksheet it is selected by default. If I try to create a new one since the previous chart is still active or selected will cause "type mismatch" error!
So what I did was calling Deselect method. Now the new problem is that the compiler doesn't like this statement:
ActiveChart.Deselect
and causes another error message: "Object Varialbe or With block variable not set"
What should I do now?!
thanks,
ak