Sub ListeComboBoxItems()
Dim i As Integer
For i = 0 To ActiveSheet.OLEObjects("MaComboBox").Object.ListCount - 1
MsgBox ActiveSheet.OLEObjects("MaComboBox").Object.List(i)
Next i
End Sub
For i = 0 To ComboBox1.ListCount - 1
Next i
For i = 0 to Combobox1.ListCount-1
msgbox ComboBox1.List(i,0) 'pour la première Colonne
next i
Je rame sur la syntaxe pour lister les items d'une ComboBox Active X chargée par des .AddItem.
Le ComboBox.ListFillRange est vide.
Private Sub CommandButton1_Click()
Dim Text As Variant
Text = Array("a", "b", "c", "d", "5", "4", "3")
Me.ComboBox1.List = Text
For i = LBound(Me.ComboBox1.List) To UBound(Me.ComboBox1.List)
MsgBox Me.ComboBox1.List(i)
Next i
End Sub
Sub ListeComboBoxItems()
Dim i As Integer
For i = 0 To ActiveSheet.OLEObjects("MaComboBox").Object.ListCount - 1
MsgBox ActiveSheet.OLEObjects("MaComboBox").Object.List(i)
Next i
End Sub
Sub ListeComboBoxItems()
Dim i As Integer
With ActiveSheet.OLEObjects(NomComboBox).Object
For i = 0 To .ListCount - 1
MsgBox .List(i)
Next i
End With
End Sub
Sub ListeComboBoxItems()
MsgBox "Comment faire ???"
Dim i, j As Integer
Dim F1 As Worksheet
Set F1 = Worksheets("Feuil1")
Dim CbBs As OLEObject
' Test nom des Objets OLE sur la Feuille
For Each CbBs In F1.OLEObjects
MsgBox CbBs.Name
Next CbBs
' La Variable
Dim CbB As OLEObject
Set CbB = F1.OLEObjects(NomComboBox)
' Test Lecture
MsgBox CbB.Object.List(LBound(CbB.Object.List))
MsgBox CbB.Object.List(1)
MsgBox CbB.Object.List(UBound(CbB.Object.List))
' Test (Transfert dans variable tableau)
Dim TCbB As Variant
TCbB = CbB.Object.List
' Test Lecture dimension du tableau a 2 Dimenssions
' Colonne maximum 10 Colonnes (Pour cette Objet)
MsgBox LBound(TCbB, 1): MsgBox UBound(TCbB, 1)
MsgBox LBound(TCbB, 2): MsgBox UBound(TCbB, 2)
' Boucle sur le tableau
' Ici que la premiére colonne de remplis soit la O
For i = LBound(TCbB, 1) To UBound(TCbB, 1) ' Lignes
For j = 0 To 0 ' Colonnes soit la colonne 1 remplis (1 sur 10)
MsgBox TCbB(i, j)
Next j
Next i
' OU
' Boucle sur l'objet OLE
For i = LBound(CbB.Object.List) To UBound(CbB.Object.List)
MsgBox CbB.Object.List(i, 0)
Next i
End Sub
Sub ListeComboBoxItems()
Dim tablo,i As Integer
tablo=ActiveSheet.OLEObjects("MaComboBox").Object.list
For i = 0 To ubound(tablo
MsgBox tablo(i,0)
Next i
End Sub
tablo = ActiveSheet.DrawingObjects("MaComboBox").Object.List