Search code examples
vbaactivextogglebutton

VBA Excel, changing an ActiveX toggle button's state


i'm having an issue with an ActiveX toggle button. I would like to be able to change its state (pushed or not) depending on a cell property.

I am trying to use the ControlFormat to access the Value property of the button like this:

Sheets("activity_tracking").Shapes("lock_unlock_curr_row").ControlFormat.Value = True

But i get error 438: "Object doesn't support this property or method". This is puzzling for me because ".ControlFormat.Enabled = True" works for this button.

I would be grateful for any insight


Solution

  • if the name of your ActiveX toggle button is lock_unlock_curr_row then consider

    Sheets("activity_tracking").lock_unlock_curr_row.Value = True