G
Guest
Hi,
I am using Excel 2000.
I create command buttons at runtime like this:For iIndx = 2 To 24 Step 4
If Cells(14, iIndx).Value <> "" Then
iBtn = iBtn + 1
Set xBtnShape = Distribution.Shapes.AddOLEObject( _
Left:=Range(Cells(1, iIndx).Address).Left, _
Top:=Range(Cells(1, iIndx).Address).Top, _
Width:=150, _
Height:=24, _
ClassType:="Forms.CommandButton.1")
With Distribution.OLEObjects(Distribution.OLEObjects.Count).Object
.Caption = "Update Distribution Class " & iBtn
End With
end if
next
<<<< END CODE <<<<<
so, this works fine, I get a new button in the right column for each column that has a value in the cell checked by the If... statement.
It then changes the caption fine.
My problem is that I cannot set the OnAction property. Using this code I want to point all my buttons at one global procedure that will check the Application.Caller value and do what is required.
Unfortunately it always gives an Application or Object defined error...
anyone had this before?
thanks
Philip
I am using Excel 2000.
I create command buttons at runtime like this:For iIndx = 2 To 24 Step 4
If Cells(14, iIndx).Value <> "" Then
iBtn = iBtn + 1
Set xBtnShape = Distribution.Shapes.AddOLEObject( _
Left:=Range(Cells(1, iIndx).Address).Left, _
Top:=Range(Cells(1, iIndx).Address).Top, _
Width:=150, _
Height:=24, _
ClassType:="Forms.CommandButton.1")
With Distribution.OLEObjects(Distribution.OLEObjects.Count).Object
.Caption = "Update Distribution Class " & iBtn
End With
end if
next
<<<< END CODE <<<<<
so, this works fine, I get a new button in the right column for each column that has a value in the cell checked by the If... statement.
It then changes the caption fine.
My problem is that I cannot set the OnAction property. Using this code I want to point all my buttons at one global procedure that will check the Application.Caller value and do what is required.
Unfortunately it always gives an Application or Object defined error...
anyone had this before?
thanks
Philip