Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trigger an event on Checkbox change
Thanks for the responses everyone, but now I have a whole new problem. I have created a function that will allow me create a checkbox in any given cell. Because I just found out that checking the checkbox will not trigger the change event on the worksheet I will need to attach a general macro to all the checkboxes I create that have a name that begins with "labor". For some reason when I run this code I get a run time error that says "Unable to set the OnAction property of the OLEObject class". Am I missing something or is there a better way to do this? 'This function will create a checkbox when given a cell range, name for the check box 'and a cell to link the value to Function Create_Checkbox(ByVal CurrCell As String, _ ByVal ListName As String, _ ByVal CellLink As String) Dim Obj As Object Dim CBox As Object Dim OldZoom As Integer OldZoom = ActiveWindow.zoom ActiveWindow.zoom = 100 Set Obj = ActiveSheet.OLEObjects.Add(classtype:="Forms.Check Box.1", _ Left:=Range(CurrCell).Left + (Range(CurrCell).width / 2) - 6.5, _ Top:=Range(CurrCell).Top + (Range(CurrCell).height / 2) - 5, _ width:=11, height:=11) Set CBox = Obj.Object CBox.Caption = "" With Obj .Name = ListName .LinkedCell = CellLink If Left(ListName, 5) = "labor" Then .OnAction = "UpdateLabor" End If End With If Range(CellLink).Value = Empty Then Range(CellLink).Value = "FALSE" End If Range("ObjectCounter").Value = Range("ObjectCounter").Value + 1 ActiveWindow.zoom = OldZoom End Function *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Trigger Event on Format Change | Excel Discussion (Misc queries) | |||
Trigger an event on Checkbox change | Excel Programming | |||
Trigger Event | Excel Programming | |||
Using a checkbox to trigger an email | Excel Programming |