일반 VBA 양식 컨트롤 개체를 ComboBox 개체로 캐스팅해야 항목을 추가 할 수 있습니다. 일반 객체는 나를Excel VBA : 일반 컨트롤 개체를 ComboBox 개체로 캐스팅하는 방법?
Dim ctlCurrent As MSForms.Control
For Each ctlCurrent In frmItemInput.Controls
If TypeName(ctlCurrent) = "ComboBox" Then
Dim lbCurrentComboBox As MSForms.ComboBox
lbCurrentComboBox = ctlCurrent 'This is where the error occurs, when I try to convert one into another
' Adiciona os itens necessários
lbCurrentComboBox.AddItem ("R")
lbCurrentComboBox.AddItem ("D")
End If
Next ctlCurrent
내 문제는 내 기존 목록에 항목을 삽입 할 수 없습니다 : 내 형태로 선택 상자의 톤을 가지고 있고 그들 모두에 대해 동일한 옵션을 추가해야합니다. 그래서 저는 이것을 progrmatically하고 싶습니다.
졸개을 시도 작동하지 않았다 마우스 오른쪽 있습니다. 세트를 사용해야합니다. – Stewbob