R
Rob Nicholson
Consider a checkbox created at run-time something like this:
Dim CheckBox As Shape
Set CheckBox=Me.Shapes.AddFormControl(xlCheckBox, 0,0,100,0)
CheckBox.OnAction="'ClickHandler'"
Sub ClickHandler()
Debug.Print "Clicked!"
End Sub
Run the code and click on the checkbox and the ClickHandler runs.
However, I'd love to be able to pass a parameter and I've read several posts
whereby it says you can set OnAction to 'ClickHandler "Hello"' and it will
pass "Hello" as the paramater:
Dim CheckBox As Shape
Set CheckBox=Me.Shapes.AddFormControl(xlCheckBox, 0,0,100,0)
CheckBox.OnAction="'ClickHandler ""Hello""'"
Sub ClickHandler(Text)
Debug.Print "Clicked!"
End Sub
This just doesn't work - the code runs without complaining but ClickHandler
never gets called when you click.
What am I doing wrong?
Thanks, Rob.
Dim CheckBox As Shape
Set CheckBox=Me.Shapes.AddFormControl(xlCheckBox, 0,0,100,0)
CheckBox.OnAction="'ClickHandler'"
Sub ClickHandler()
Debug.Print "Clicked!"
End Sub
Run the code and click on the checkbox and the ClickHandler runs.
However, I'd love to be able to pass a parameter and I've read several posts
whereby it says you can set OnAction to 'ClickHandler "Hello"' and it will
pass "Hello" as the paramater:
Dim CheckBox As Shape
Set CheckBox=Me.Shapes.AddFormControl(xlCheckBox, 0,0,100,0)
CheckBox.OnAction="'ClickHandler ""Hello""'"
Sub ClickHandler(Text)
Debug.Print "Clicked!"
End Sub
This just doesn't work - the code runs without complaining but ClickHandler
never gets called when you click.
What am I doing wrong?
Thanks, Rob.