[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How can I dynamically populate a combo box list based on a previous list box choice using Word 2007 Content Controls

Posted on 2010-11-22
2
Medium Priority
?
604 Views
Last Modified: 2012-05-10
I'm designing a tabular form in Word 2007 to be used across my firm's IT deptartment for Change Management. I'd like to use a content control list box to display a list of systems (i.e. 'Front End', 'Back End', 'Database', 'Infrastructure', 'Batch', etc.). Selecting a member of this list would cause a list of names to be available in a combo box of Resources. The user would then select one member of this resource list. A different list of resources would be available for selection based on the selection made in the Systems list box. For now, at least, resource lists would be maintained in document source code.

I've developed several Excel applications using VBA, but have never ventured into Word. I'm trying to determine if I can use these nice-looking content controls to accomplish my task, or should just stick with VBA controls.

Have looked around extensively for materials that discuss how to code for these content controls, without any luck. In addition to advice on my question, would also greatly appreciate any feedback on resource material on coding for these content controls - books, tutorials, etc.
0
Comment
Question by:DBuzzell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 1000 total points
ID: 34187920
You need some code like this. It goes in the ThisDocument module of the document.

Note that it uses the Tag property to distinguish between controls, sot that needs to be set for both.
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim cc2 As ContentControl
    If ContentControl.Tag = "First" Then
        For Each cc2 In ActiveDocument.ContentControls
            If cc2.Tag = "Second" Then
                cc2.DropdownListEntries.Clear
                Select Case ContentControl.Range.Text
                    Case "Red"
                        cc2.DropdownListEntries.Add "Scarlet"
                        cc2.DropdownListEntries.Add "Vermillion"
                    Case "Blue"
                        cc2.DropdownListEntries.Add "Navy"
                        cc2.DropdownListEntries.Add "Azure"
                End Select
            End If
        Next cc2
   End If
End Sub

Open in new window

0
 

Author Closing Comment

by:DBuzzell
ID: 34273775
The solution provided the foundation for me to code a complete solution
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A few years ago I was very much a beginner at VBA, and that very much remains the case today.  I'll do my best to explain things as I go in the hope that other beginners can follow.  If you just want to check out a tool that creates a Select Case fu…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question