#1   Report Post  
wrightvj
 
Posts: n/a
Default Drop Down List

How do I create a drop down list in a word or excel document?
  #2   Report Post  
Crouchie1998
 
Posts: n/a
Default

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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Word & Drop Down Menu's starkman Microsoft Word Help 1 January 2nd 05 10:39 PM
Recently Used Fonts List Mark Wharton Microsoft Word Help 0 December 18th 04 11:25 PM
How does one get a drop down menu to drop down? TTMcG Microsoft Word Help 1 December 17th 04 04:59 AM
How to update 2003 Word Doc for 2004 with Excel list Dennis Microsoft Word Help 1 December 4th 04 08:06 AM
How to change tabs in list template? hstijnen Microsoft Word Help 1 November 24th 04 01:54 PM


All times are GMT +1. The time now is 02:09 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"