Condtional ComboBoxes

J

Jeff

I am trying to have a second comboBox be contingent on the answer of the first.
In the first ComboBox there are two choices “Professional†and “Leadershipâ€.
I would like only the corresponding answers to appear in the second
ComboBox. Is this possible in word? If so How? Any help would be welcome.
 
J

Jeff

I have tried this code and similar codes. Could you tell me what i am doing
wrong?
Sample Code

Private Sub Dropdown1_Click()

PrimaryDD.AddItem "Professional"
PrimaryDD.AddItem "Leadership"
End Sub

Sub OnExitDropdown1()

Dim oDD As DropDown
Set oDD = ActiveDocument.FormFields("Dropdown2").DropDown
'Clear previous list
oDD.ListEntries.Clear
'Repopulate list based on user selection
Select Case ActiveDocument.FormFields("Dropdown1").Result

Case "A"
With oDD.ListEntries
.Add "Drives For Results"
.Add "Communication"
.Add "Teamwork"
.Add "Buisness Mindset"
End With
Case "B"
With oDD.ListEntries

.Add "Results-Oriented Leader"
.Add "Team Player"
.Add "Inspiring Coach"
.Add "Strategic and Broad Thinker"
End With

End Select
End Sub
 
G

Greg Maxey

Jeff,

Hard to say what you are doing wrong without an understanding of what
you are trying to do. Your code indicates that you are using a
protected form with dropdown fields. Your original question asked
about comboboxes. Comboboxes don't exist in protected forms.

To get your current code working with two dropdown fields just change
"A" and "B" to "Professional" and "Leadership"
 
G

Greg Maxey

Jeff,

Dropdown boxes aren't combo boxes. In your current code, change ""A"
and "B" to "Professional" and "Leadership"
 
J

Jeff

I was trying to use comboboxes. Afteri replied i got it right. I appreciate
your time.
Also, I have a spell check & Print button on my form that wont work when
the document is protected any ideas?
 
J

Jonathan West

Jeff said:
I was trying to use comboboxes. Afteri replied i got it right. I appreciate
your time.
Also, I have a spell check & Print button on my form that wont work when
the document is protected any ideas?

How to enable the spellchecker in a protected document
http://www.word.mvps.org/FAQs/MacrosVBA/SpellcheckProtectDoc.htm


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top