View Single Post
 
Old 12-03-2020, 01:52 PM
src144 src144 is offline Windows 10 Office 2019
Novice
 
Join Date: Nov 2020
Posts: 4
src144 is on a distinguished road
Default

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
Attached Files
File Type: docm Test Contract.docm (35.6 KB, 4 views)

Last edited by macropod; 12-03-2020 at 05:36 PM. Reason: Added code tags
Reply With Quote