Bonjour,
Je souhaite utiliser excel pour remplir une comboBox Word. Voici mon Userform (nommée Defaut) :
Private Sub ComboBox1_Change()
ActiveDocument.FormFields("Texte21").Result = Me.ComboBox1.Value
Defaut.Hide
End Sub
Public Sub UserForm_Initialize()
Dim xlApp As Excel.Application
Dim xlSheet As Excel.Worksheet
Dim xlBook As Excel.Workbook
Dim myList(3) As String
Dim i As Integer
i = 1
Set xlBook = xlApp.Workbooks.Open("d:\Documents And Settings\t0089889\Bureau\Fichiers Développement Fournisseur\Liste.xls")
Set xlSheet = xlBook.Worksheets("Feuil1")
For i = 1 To 3
myList(i) = xlSheet.Cells(i, 1).Value
ComboBox1.AddItem myList(i)
Next i
Debug.Print ComboBox1.ListCount
Set xlApp = Nothing
End Sub
et j'utilise un module:
Sub gocombobox3()
Defaut.Show
End Sub
Le message d'erreur est "variable objet ou variable de bloc with non définie". Après avoir bien lutté, je ne vois pas ce qui cloche. Je vous remercie de votre aide! Nico
Configuration: Windows XP
Internet Explorer 6.0