组合框 Activex 错误
Combobox Activex Error
我正在尝试 运行 具有三个值 "AD"、"LN" 和 "RSA" 的组合框 activex,这些值 运行 每个都是不同的宏.我做不到的事情。每当我 select 任何选项时,我都会在行 Select Case .List
中收到错误 "Object doesn't support this property or method"。有任何想法吗?这是代码。
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
试试这个代码:
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
此代码尚未经过测试,因此可能需要进行细微调整。
我正在尝试 运行 具有三个值 "AD"、"LN" 和 "RSA" 的组合框 activex,这些值 运行 每个都是不同的宏.我做不到的事情。每当我 select 任何选项时,我都会在行 Select Case .List
中收到错误 "Object doesn't support this property or method"。有任何想法吗?这是代码。
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
试试这个代码:
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
此代码尚未经过测试,因此可能需要进行细微调整。