View Single Post
 
Old 10-08-2017, 08:35 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

See attached.

Note: Unless you want spaces either side of your Description, Reason, and Objective outputs, you shouldn't have them in the TestNo control's values.

A generic version of the code is:
Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Application.ScreenUpdating = False
Dim i As Long, StrDetails As String
With ContentControl
  If .Title = "Client" 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("Output1")(1)
      .LockContents = False
      .Range.Text = Split(StrDetails, "|")(0)
      .LockContents = True
    End With
    With ActiveDocument.SelectContentControlsByTitle("Output2")(1)
      .LockContents = False
      .Range.Text = Split(StrDetails, "|")(1)
      .LockContents = True
    End With
    With ActiveDocument.SelectContentControlsByTitle("Output3")(1)
      .LockContents = False
      .Range.Text = Split(StrDetails, "|")(2)
      .LockContents = True
    End With
  End If
End With
Application.ScreenUpdating = True
End Sub
Attached Files
File Type: docm Test Report Template Upload.docm (50.5 KB, 327 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote