Private
Sub
Document_ContentControlOnExit(
ByVal
CC
As
ContentControl, Cancel
As
Boolean
)
Dim
valNr
As
Long
, i
As
Long
If
CC.Type = wdContentControlDropdownList
Then
If
CC.Tag =
"ddArtRmStBez"
Then
For
i = 1
To
CC.DropdownListEntries.count
If
CC.DropdownListEntries(i).Text = CC.Range.Text
Then
valNr = CC.DropdownListEntries(i).Value
End
If
Next
i
If
valNr = 1
Then
collapseTable
"tmFlaechRaeum"
,
False
, CC
Else
collapseTable
"tmFlaechRaeum"
,
True
, CC
End
If
If
valNr = 2
Then
collapseTable
"tmObFlaech"
,
False
, CC
Else
collapseTable
"tmObFlaech"
,
True
, CC
End
If
End
If
End
If
End
Sub
Function
collapseTable(bm, collapse, currCC)
Dim
curTable
As
Table
Set
curTable = ActiveDocument.Bookmarks(bm).Range.Tables(1)
Dim
tableContentRange
As
Range
Set
tableContentRange = curTable.Range.Rows(1).Range
tableContentRange.
End
= curTable.Range.
End
tableContentRange.
Select
If
collapse =
True
Then
Selection.Expand Unit:=wdParagraph
Selection.Range.Font.Hidden =
True
Selection.collapse wdCollapseEnd
Else
Selection.Expand Unit:=wdParagraph
Selection.Range.Font.Hidden =
False
Selection.collapse wdCollapseEnd
End
If
If
ActiveDocument.Bookmarks.Exists(
"tmBndLnd"
)
Then
Word.Selection.
GoTo
What:=wdGoToBookmark, Name:=
"tmBndLnd"
End
If
End
Function