0
votes

I'm trying to run a combobox activex with three values "AD", "LN", and "RSA" these values run each a different Macro. The thing I can't do it work. Whenever I select any option I get the error "Object doesn't support this property or method" in the line Select Case .List. Any ideas? This is the code.

Private Sub ComboBox1_Change()
    With ThisWorkbook.Sheets("Operations").Shapes("ComboBox2").ControlFormat
        Select Case .List
            Case "AD": AD_Email
            Case "LN": LN_Email
            Case "RSA": RSA_Email
        End Select
    End With
End Sub
1

1 Answers

0
votes

Try this code instead:

Dim ws as Worksheet 
Dim cb as Combobox

Private Sub ComboBox1_Change()
    Set ws = ThisWorkbook.Sheets("Operations")
    Set cb = ws.OLEObjects("ComboBox2").Object
        Select Case cb.Value
            Case "AD": AD_Email
            Case "LN": LN_Email
            Case "RSA": RSA_Email
        End Select
End Sub

This code has not been tested so minor tweaks might be needed.