Article ID: 194027
Article Last Modified on 6/17/2005
Private Sub frmcombo_Initialize() ComboBox1.ColumnCount = 1 ' Load MyArray MyArray(0) = "Zero" MyArray(1) = "One" MyArray(2) = "Two" MyArray(3) = "Three" ' Load data into ComboBox ComboBox1.List() = MyArray ComboBox1.Value = MyArray(1) End Suband then close the code window.
Private Sub ComboBox1_Change()
ActiveDocument.FormFields("Text1").Result = ComboBox1.Value
End Sub
and then close the code window.Private Sub Cmdclose_Click() Unload Me End Suband then close the code window. CONTROL+Click the command button and click Properties on the shortcut menu. On the Alphabetic tab, rename (Name) to Cmdclose and then rename Caption to Close. Close the CommandButton Properties window.
Dim MyArray(3)
Sub gocombobox()
frmcombo.Show
End Sub
NOTE: Make sure the DIM MyArray() statement contains the highest array
number of the items contained in your array (not the total number of
array items) from step 3 of the "Create the User Form Combo Box"
procedure listed in this article. For example, if you add a
fifth item (MyArray(4) = "Four") to the example array in step 3 of the
"Create the User Form Combo Box" procedure, make sure you change the
DIM MyArray(3) statement to DIM MyArray(4).
Additional query words: vba
Keywords: kbhowto kbfield KB194027