Hi all,
I found a video on the internet that was very helpful with creating a dependent list; however, the only issue is that is not dynamic. Here is my dilemma:
I have my VBA to work where:
Utility Type can equal: "Electricity, Diesel, Natural Gas, Propane ...."
Utility Type can equal: "City/Industrial Water, RO/Purified..."
Utility Type can equal: "Hazardous, Non-haz..."
However, it only works when it is not in a Repeating Section content control (RSCC). When it is in the RSCC and the user adds a new row, the Utility box column will change freely, but the Utility Type box will still be dependent on the Utility box in thefirst row:
| Utility |
Utility Type |
| Energy (Drop down menu) - A1 |
(Drop down menu) Works |
| Energy (Drop down menu) - A2 |
(Drop down menu) Dependent on A1 |
| Energy (Drop down menu) - A3 |
(Drop down menu) Dependent on A1 |
I'm not sure how to make it such that it will be dynamic; anytime the user adds a new row, the Utility Type List will be dependent on the Utility adjacent to it, not the parent in the first row, first column
My VBA code is:
Sub PopulateddStatus()
Dim xDirection As FormField
Dim xState As FormField
On Error Resume Next
Set xDirection = ActiveDocument.FormFields("Utility")
Set xState = ActiveDocument.FormFields("UtilityType")
If ((xDirection Is Nothing) Or (xState Is Nothing)) Then Exit Sub
With xState.DropDown.ListEntries
.Clear
Select Case xDirection.Result
Case "Energy"
.Add "Electricity"
.Add "Natural Gas"
Case "Water"
.Add "RO/Purified Water"
.Add "City/Industrial Water"
Case "Waste"
.Add "Hazardous"
.Add "Non Hazardous"
End Select
End With
End Sub
This solution can be solved in Excel, but for the intended purposes, our company needs it in Word.
Thank you!