So this is what I have...This contract will contain other content controls and dropdowns. This whole document needs to be restricted to fillable forms and having these content controls uneditable (as other areas do need to be edited).
Code:
Option Explicit
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Application.ScreenUpdating = False
Dim i As Long, j As Long, StrDetails As String, StrTmp As String
With ContentControl
If .Title = "Hours" Then
For i = 1 To .DropdownListEntries.Count
If .DropdownListEntries(i).Text = .Range.Text Then
StrDetails = .DropdownListEntries(i).Value
Exit For
End If
Next
With ActiveDocument.Tables(2)
For i = 1 To 2
StrTmp = Split(StrDetails, "|")(i - 1)
For j = 2 To 7
.Cell(i, j).Range.Text = Split(StrTmp, ",")(j - 2)
Next
Next
End With
End If
End With
Application.ScreenUpdating = True
End Sub
Where would I enter?...
Code:
For j = 2 To 7
With .Cell(i, j).Range.ContentControls(1)
.LockContents = False
.Range.Text = Split(StrTmp, ",")(j - 2)
.LockContents = True
End With
Next