Hi Hi
I somehow got it work, but when i add it another condition for the checkbox, it stops working.
Where did i get it wrong?
Pl help me. Thanks a lot.
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean) Application.ScreenUpdating = False Dim i As Long, StrDetails As String Dim oRng As Range With ContentControl If .Title = "NameofCompany" Then For i = 1 To .DropdownListEntries.Count If .DropdownListEntries(i).Text = .Range.Text Then StrDetails = .DropdownListEntries(i).Value Exit For End If Next If StrDetails = "" Then StrDetails = "||" With ActiveDocument.SelectContentControlsByTitle("Address")(1) .LockContents = False .Range.Text = Split(StrDetails, "|")(0) .LockContents = True End With With ActiveDocument.SelectContentControlsByTitle("Owner1")(1) .LockContents = False .Range.Text = Split(StrDetails, "|")(1) .LockContents = True End With End If End With Set oRng = ActiveDocument.Bookmarks("bmEditSch").Range Set iRng = ActiveDocument.Bookmarks("bmEditAut").Range If ContentControl.Tag = "Checkbox1" Then If ContentControl.Checked = True Then If ActiveDocument.ContentControls("Owner1") = Sch Then oRng.Font.Hidden = False iRng.Font.Hidden = True Else oRng.Font.Hidden = True iRng.Font.Hidden = False End If End If End If ActiveDocument.Fields.Update Application.ScreenUpdating = True End Sub




Reply With Quote