Home > service-is-programming, service-is-testing-troubleshooting-debugging > Expanding the Review and Modify Content Control Properties to include Repeating Sections

Expanding the Review and Modify Content Control Properties to include Repeating Sections

  1. Greg Maxey provides a lot of useful information on MS-Word content Controls, including a VBA utility to more easily loop through the properties and placeholder text dialogue of Content Controls when building your MS-Word forms.
  2. Unfortunately, the latter bit fails with nested repeating (wdContentControlRepeatingSection):
  3. The debugger shows that it Errors on non placeholder text of repeating controls set to
  4. “.txtPHText = oCC.PlaceholderText” which it breaks into, and a watch put on oCC shows:
  5. The form 1 (display of inbuilt form ) works and is useful also for wdContentControlRepeatingSection, while form 2 has no use for wdContentControlRepeatingSection. So as a workaround, we just do not show form 2 if placeholder text isNothing:
  6. We have no pretension to redistribute, get the utility from Greg’s website, it is open and you can extend it with above, if you need to.
Sub CCPropertiesReviewModify()
    Dim oFrm As frmCC
    bCancel = False
    If ActiveDocument.ContentControls.Count > 0 Then
        For Each oCC In ActiveDocument.ContentControls
            Set oFrm = New frmCC
            If Not isNothing(oCC.PlaceholderText) Then 'trp
                With oFrm
                    .Caption = oCC.Title
                    .txtPHText = oCC.PlaceholderText
                End With
           End If
        If bCancel Then Exit For
        Next oCC
        Unload oFrm
        Set oFrm = Nothing
    MsgBox "This document does not contain any Content Controls.", vbInformation, "Review\Set Content Control Properties"
    End If
lbl_Exit:       Exit Sub
End Sub

Now what about wdContentControlGroup?

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: