what is the correct way to add the control at runtime?
In excel using VBA i use this:
Dim oleObj As OLEObject
Dim strChartName As String
strChartName = "something"
Set oleObj = ActiveSheet.OLEObjects.Add(ClassType:="TeeChart.TChart", Left:=150, Top:=300Width:=500Height:=375)
oleObj.name = strChartName
when i step through the code i get a run time error 438 at the set oleObj line and the execution ends. However, the chart object is created on the sheet and it does take the name as specified in strChartName.
but the following code is never reached
Dim tcChart As teechart.TChart
Set tcChart = oleObj.OLEFormat.Object.Object
tcChart.RemoveAllSeries
tcChart.AddSeries scLine
etc. etc..
i am using version 7.0.0.7 of TeeChart7.ocx
thanks for any pointers
adding control at runtime in Excel using VBA
Hi,
how about using the following code :
?
how about using the following code :
Code: Select all
Set TChart = ActiveSheet.OLEObjects.Add(ClassType:="TeeChart.TChart",
Link:=False, _
DisplayAsIcon:=False, Left:=fLeft, Top:=fTop, Width:=fWidth,
Height:=fHeight)
Pep Jorge
http://support.steema.com
http://support.steema.com