PDA

View Full Version : can a userform be a child object of a chart



bigt95nt
05-12-2011, 11:38 AM
Below are two class methods. The first creates a shape on the chart. The second creates a simple userform. The second method is called from within the first.

Once the "ovlPointer" is created it acts like a "child object" .ie when you move the "ovlPointer" it is constrained by the chart boundries; however, when the userform is created it is outside of the chart boundries and seems to be independent of the chart.

Please comment

Thanks,
Tony


Private Sub mchtChart_Activate()

Dim tt As Object
Set tt = ActiveChart.Shapes.AddShape(msoShapeOval, 25, 25, 20, 20)
tt.Name = "ovlPointer"
Me.mchtChart.Shapes.Range(Array("ovlPointer")).Fill.Transparency = 1

Call LegendControl2(Me)
End Sub

Sub LegendControl2(oChart As CChart)

With UserForm1
.Left = oChart.mchtChart.Legend.Left
.Top = oChart.mchtChart.Legend.Top
.Width = 100
.Height = newControls.Count * 20 + 1
End With
UserForm1.Show
End Sub