ActiveX Option Buttons Not Recognized as OLEObjects?

  • Hi!

    I added several sets of ActiveX option buttons to a worksheet. I want to identify which button in each group has been selected. Each group is uniquely named. Each option button is uniquely named. I am referencing the objects as OLEObjects.






    obYesAppUse, obNoAppUse

    obYesLogins, obNoLogins

    obYesDownloads, obNoDownloads

    I was not getting the result I expected, so I checked to get a count of OLEObjects on my sheet, and the response I received was zero. It appears that my option buttons are not getting recognized as OLEObjects, and that's why I'm not getting my expected results. I am clearly missing something basic, but I don't know what.

    I ran this to perform a basic check of my assumption regarding the option buttons being OLEObjects and was surprised to see zero OLEObjects.

    Sub CheckButtons()

    Dim ctrl As OLEObject

    MsgBox "start"

    Dim i As Integer

    i = ActiveSheet.OLEObjects.Count

    MsgBox (i)

    End Sub

    I would appreciate some help getting pointed in the right direction.

    Thanks -


  • Well, I'm using Excel365, so I wonder how that may be interfering, but...when I created the buttons, I inserted using the ActiveX Controls option buttons, not the Form Controls option buttons.

  • However, I had the code block on the module and not on the sheet. Moving my code to the sheet identified the objects successfully. I knew it was something basic - thanks for helping me clarify my thoughts.

  • Welcome to the Forum. Please read the Forum Rules to understand how the Forum works and why I have added Code Tags to your post

    All VBA code posted in the forum must be wrapped in code tags, which you omitted, including single-line code snippets.Be sure to use them in future posts.

    How to use code tags

    Note: no apostrophe in the tags, just used for demonstration here.


    your code goes between these tags


    Or, just highlight all of the code and press the <> in the post menu above button to add the code tags.


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!