Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Public Sub UserForm_Initialize()
Dim xlApp As New Excel.Application
Dim xlSheet As Excel.Worksheet
Dim xlBook As Excel.Workbook
Dim myList(26) As String
Dim i As Integer
i = 1
Set xlBook = xlApp.Workbooks.Open("c:\temp\famille.xls")
 
Set xlSheet = xlBook.Worksheets("Sheet1")
For i = 1 To 26
myList(i) = xlSheet.Cells(i, 1).Value
ComboBox1.AddItem myList(i)
 
Next i
Debug.Print ComboBox1.ListCount
Set xlApp = Nothing
End Sub
Dans ce cas, je connaissais le nombre d'entrées de mon fichier Excel.