Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Drop Down List
How do I create a drop down list in a word or excel document?
|
#2
|
|||
|
|||
Open MS Word
Right-click the toolbar & select 'Control Toolbox' Double-click 'ComboBox' (its added to your project) Right-click the combobox on the form & choose PROPERTIES Under NAME choose 'cboNames' (cbo is the prefix used in programming to represent a combobox) Right-click the control & choose 'View code' In the right-hand pane, you'll see two drop down lists. In the left one choose DOCUMENT & in the right one choose choose OPEN (some code shows below): Private Sub Document_Open() End Sub In between the Sub/End Sub, paste in the following code: With cboNames .AddItem ("Sarah") .AddItem ("Sue") .AddItem ("Peter") .ListIndex = 0 End With Now, your code should look like this: Private Sub Document_Open() With cboNames .AddItem ("Sarah") .AddItem ("Sue") .AddItem ("Peter") .ListIndex = 0 End With End Sub The list index property will list Sarah as the selected item in the list. VBA/VB is 0 (zero) based. Therfore, the first item is 0, second item is 1 and so on. Click the green triangle to run (F5) the above code & you should have a working combobox. I hope this helps "wrightvj" wrote: How do I create a drop down list in a word or excel document? |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Word & Drop Down Menu's | Microsoft Word Help | |||
Recently Used Fonts List | Microsoft Word Help | |||
How does one get a drop down menu to drop down? | Microsoft Word Help | |||
How to update 2003 Word Doc for 2004 with Excel list | Microsoft Word Help | |||
How to change tabs in list template? | Microsoft Word Help |