Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2007

Tip: Looking for answers? Try searching our database.

Condtional ComboBoxes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeff - 17 Apr 2007 22:22 GMT
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.
Greg Maxey - 17 Apr 2007 22:39 GMT
See the bit on cascading listboxes here:
http://gregmaxey.mvps.org/Populate_UserForm_ListBox.htm

Signature

Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

> 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.
Jeff - 18 Apr 2007 14:48 GMT
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
 

> See the bit on cascading listboxes here:
> http://gregmaxey.mvps.org/Populate_UserForm_ListBox.htm
[quoted text clipped - 5 lines]
> > ComboBox. Is this possible in word? If so How? Any help would be
> > welcome.
Greg Maxey - 18 Apr 2007 15:57 GMT
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"

> I have tried this code and similar codes. Could you tell me what i am doing
> wrong?
[quoted text clipped - 51 lines]
>
> - Show quoted text -
Greg Maxey - 18 Apr 2007 16:17 GMT
Jeff,

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

> I have tried this code and similar codes. Could you tell me what i am doing
> wrong?
[quoted text clipped - 51 lines]
>
> - Show quoted text -
Jeff - 18 Apr 2007 17:47 GMT
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?

> Jeff,
>
[quoted text clipped - 56 lines]
> >
> > - Show quoted text -
Jonathan West - 18 Apr 2007 19:25 GMT
>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

Signature

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

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.