
هنا اليكم الكود النهائي للفورم شاملا ويرجى الانتباه للاسماء حيث ممكن ان تكون مختلفة مثلا بدل combobox1 ممكن يكون combobox2 هكذا... وهنا وضعت نموذجين بدل من واحد اذا تلاحظ:
كود:
Private Sub ComboBox1_Change()
ActiveDocument.FormFields("combobox1").Result = ComboBox1.Value
End Sub
Private Sub ComboBox2_Change()
ActiveDocument.FormFields("combobox2").Result = ComboBox2.Value
End Sub
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
ComboBox1.ColumnCount = 1
ComboBox2.ColumnCount = 1
'Load data into ComboBox
ComboBox1.List() = Array("Zero", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27")
ComboBox2.List() = Array("Zero", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27")
End Sub