View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rock Rock is offline
external usenet poster
 
Posts: 6
Default Glolbal Variables Reset when using OleObjects

I am having where my global variables are being reset when a
subroutine processes/creates OleObject checkboxes. The check boxes
are on the worksheet and are used to turn on and off data points.

I also have a chart where I use with mouse events to select datapoint
off the graph. I have defined an EventsClassModule (since I create
the chart on the fly) and I initialize it and it works fine until
another routine is excecuted where I process data, add checkboxes
(OleObject) and create new charts.

If I comment out the call to the addCheckBox routine, the golbal
variables and the eventsClassModule work fine.

Any suggestions on how to get around this problem?

Thanks in advance for the help.

Rock


Here is the routine to create the checkboxes:

Private Sub addCheckBox(rw As Long, cl As Long)
Dim myRng As Range, myCell As Range, myObj As Object

With adjSH
Set myRng = .Cells(rw, cl)
For Each myCell In myRng.Cells
Set myObj = ActiveSheet.CheckBox.Add
'Left:=myCell.Left + 0.5 * myCell.Width - 0.5
* myCell.Height, _
'Top:=myCell.Top, Width:=myCell.Height,
Height:=myCell.Height)
myObj.Name = "chkbox" & myCell.Row
myObj.Object.Value = True
myObj.Object.Caption = ""
myObj.Object.GroupName = "checkboxes"
myObj.Placement = xlFreeFloating
Next myCell
End With
Set myObj = Nothing

End Sub