Salut tout le monde!
Je voudrais alimenter une combobox avec le nom de toutes les feuilles d'un classeur grâce au code suivant:
Dim xlapp As New Excel.Application
Dim xlbook As New Excel.Workbook
Set xlbook = xlapp.Workbooks.Open("C:\Users\...\BaseDonnéesPesée.xls")
Set mondico = CreateObject("Scripting.Dictionary")
With xlbook
For i = 1 To .Sheets.Count
If Not mondico.Exists(.Sheets(i).Name) Then
mondico.Add .Sheets(i).Name, .Sheets(i).Name
End If
Next i
End With
Application.DisplayAlerts = False
xlbook.Close savechanges:=False
Application.DisplayAlerts = True
xlapp.Quit
Set xlbook = Nothing
Set xlsheet = Nothing
With Me.NumCheptel
.List = mondico.items
End With
Cà marche trés bien pour un userform mais un autre me dit "Erreur execution 70, Accès refusé"
Qu'est ce qui se passe je vous le demande?
A L'AIDE! et à bientôt