Microsoft 365 Liste déroulante sur Word à partir d'une base de données Excel

natruim

XLDnaute Nouveau
Bonjour,
Je souhaiterais créer une liste déroulante sur Word à partir d'une liste sur excel.
J'ai créé ça mais je suis complètement novice car je ne sais pas la mettre sur la liste déroulante sur Word:


Private Sub ComboBox1_DropButtonClick()
With ComboBox1
.AddItem "09h00"
.AddItem "09h05"
.AddItem "09h10"
.AddItem "09h15"
.AddItem "09h20"
.AddItem "09h25"
.AddItem "09h30"
.AddItem "09h35"
.AddItem "09h40"
.AddItem "09h45"
.AddItem "09h50"
.AddItem "09h55"
.AddItem "10h00"
.AddItem "10h05"
.AddItem "10h10"
.AddItem "10h15"
.AddItem "10h20"
.AddItem "10h25"
.AddItem "10h30"
.AddItem "10h35"
.AddItem "10h40"
.AddItem "10h45"
.AddItem "10h50"
.AddItem "10h55"
.AddItem "11h00"
.AddItem "11h05"
.AddItem "11h10"
.AddItem "11h15"
.AddItem "11h20"
.AddItem "11h25"
.AddItem "11h30"
.AddItem "11h35"
.AddItem "11h40"
.AddItem "11h45"
.AddItem "11h50"
.AddItem "11h55"
.AddItem "12h00"
.AddItem "12h05"
.AddItem "12h10"
.AddItem "12h15"
.AddItem "12h20"
.AddItem "12h25"
.AddItem "12h30"
.AddItem "12h35"
.AddItem "12h40"
.AddItem "12h45"
.AddItem "12h50"
.AddItem "12h55"
.AddItem "13h00"
.AddItem "13h05"
.AddItem "13h10"
.AddItem "13h15"
.AddItem "13h20"
.AddItem "13h25"
.AddItem "13h30"
.AddItem "13h35"
.AddItem "13h40"
.AddItem "13h45"
.AddItem "13h50"
.AddItem "13h55"
.AddItem "14h00"
.AddItem "14h05"
.AddItem "14h10"
.AddItem "14h15"
.AddItem "14h20"
.AddItem "14h25"
.AddItem "14h30"
.AddItem "14h35"
.AddItem "14h40"
.AddItem "14h45"
.AddItem "14h50"
.AddItem "14h55"
.AddItem "15h00"
.AddItem "15h05"
.AddItem "15h10"
.AddItem "15h15"
.AddItem "15h20"
.AddItem "15h25"
.AddItem "15h30"
.AddItem "15h35"
.AddItem "15h40"
.AddItem "15h45"
.AddItem "15h50"
.AddItem "15h55"
.AddItem "16h00"
.AddItem "16h05"
.AddItem "16h10"
.AddItem "16h15"
.AddItem "16h20"
.AddItem "16h25"
.AddItem "16h30"
.AddItem "16h35"
.AddItem "16h40"
.AddItem "16h45"
.AddItem "16h50"
.AddItem "16h55"
.AddItem "17h00"
.AddItem "17h05"
.AddItem "17h10"
.AddItem "17h15"
.AddItem "17h20"
.AddItem "17h25"
.AddItem "17h30"
.AddItem "17h35"
.AddItem "17h40"
.AddItem "17h45"
.AddItem "17h50"
.AddItem "17h55"
.AddItem "18h00"
.AddItem "18h05"
.AddItem "18h10"
.AddItem "18h15"
.AddItem "18h20"
.AddItem "18h25"
.AddItem "18h30"
.AddItem "18h35"
.AddItem "18h40"
.AddItem "18h45"
.AddItem "18h50"
.AddItem "18h55"
.AddItem "19h00"

End With
End Sub
Sub ListBox1()
'
' ListBox1 Macro
'
'

End Sub
 

Staple1600

XLDnaute Barbatruc
Bonjour le fil

=>natruim
[Juste pour infos]
Je te propose une écriture simplifiée (et qui prend moins de place ;))
pour remplir ton ComboBox
VB:
Private Sub UserForm_Initialize()
Dim h%, m%
With ComboBox1
    For h = 9 To 18
        For m = 0 To 55 Step 5
        .AddItem Format(h & ":" & m, "hh:mm")
        Next
    Next
    .AddItem Format("19:00", "hh:mm"), .ListCount
End With
End Sub
Pour le reste de ta question:
Ta Combo se situe sur un Userform qui est dans ton document Word?
 

Statistiques des forums

Discussions
314 499
Messages
2 110 247
Membres
110 711
dernier inscrit
chmessi