Rem Attribute VBA_ModuleType=VBADocumentModule
Option VBASupport 1
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
'MsgBox "Aufruf 1"
Unterauswahl
End Sub
Sub Unterauswahl()
Dim dropdown1 As ContentControl
Dim dropdown2 As ContentControl
Dim options() As String
Dim selectedOption As String
Dim i As Integer
'MsgBox "Aufruf 2"
Set dropdown1 = ActiveDocument.SelectContentControlsByTitle("MainCategory").Item(1)
Set dropdown2 = ActiveDocument.SelectContentControlsByTitle("SubCategory").Item(1)
'Auslesen der getroffen Auswahl in der MainCategor
selectedOption = dropdown1.Range.Text
'MsgBox selectedOption
'Logik-Verknüpfung; funktioniert (evt. mit Array arbeiten, für Optionen mit Beistrichen im Anzeigetext (z.B.: Mixing, Dosing Chemicals & Thickening))
If selectedOption = "Woodyard" Then
options = Split("Select Subcategory, General Safety, Wood Delivery & Acceptance, Debarking, Chipping, Storage, Screening, Other", ",")
ElseIf selectedOption = "Fibre Production" Then
options = Split("Select Subcategory, General Safety, Digesting, Washing & Screening, Bleaching, Other", ",")
ElseIf selectedOption = "Chemicals Preparation" Then
options = Split("Select Subcategory, General Safety, Chemicals Preparation, Other", ",")
ElseIf selectedOption = "Recovery" Then
options = Split("Select Subcategory, General Safety, Evaporation Plant, Recovery Boiler, Caustification, Lime Kiln, CNGG Boilers, Tall Oil Plant, Other", ",")
ElseIf selectedOption = "Pulp Drying Machine" Then
options = Split("Select Subcategory, General Safety, Screening & Cleaning, Pulp Dewatering, Pulp Sheet Drying, Baling, Other", ",")
ElseIf selectedOption = "Pulp Preparation" Then
options = Split("Select Subcategory, General Safety, Pulping, Refining, Mixing & Dosing Chemicals & Thickening, Fibre Cleaning & Screening, Reject Handling, Other", ",")
ElseIf selectedOption = "Paper Machine" Then
options = Split("Select Subcategory, General Safety, Stock Preparation, Approach Flow System, Broke Handling System, Vacuum System, Chemicals, Additives, Starch, Wire Section, Press Section, Drying Section, Calander & Sizer & Clupak, Pope Reeler, Winder, Other", ",")
ElseIf selectedOption = "Paper Finishing" Then
options = Split("Select Subcategory, General Safety, Cutsize Finishing Line, Folio Finishing Line, Logistics & Packaging & Loading, Other", ",")
ElseIf selectedOption = "Power Generation" Then
options = Split("Select Subcategory, General Safety, HP Boiler, LP Boiler / steampacks, Steam Turbines & Generators, Electrical Generators, Gas Turbines, Other", ",")
ElseIf selectedOption = "Utilities" Then
options = Split("Select Subcategory, General Safety, Compressed Air System, Water Preparation Plant, Waster Water Treatment Plant, Cooling System Tower, PCC Kiln, Other", ",")
ElseIf selectedOption = "Other Assets" Then
options = Split("Select Subcategory, General Safety, Buildings, Other", ",")
Else
options = Split("Select Main Category first", ",")
End If
' Löschen Dropdown2
For i = dropdown2.DropdownListEntries.Count To 1 Step -1
dropdown2.DropdownListEntries(i).Delete
Next i
'überschreiben der Liste
For i = LBound(options) To UBound(options)
dropdown2.DropdownListEntries.Add Text:=options(i)
Next i
End Sub