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
- 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.
- Unfortunately, the latter bit fails with nested repeating (wdContentControlRepeatingSection):
- The debugger shows that it Errors on non placeholder text of repeating controls set to
- “.txtPHText = oCC.PlaceholderText” which it breaks into, and a watch put on oCC shows:
- 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:
- 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 oCC.Range.Select Dialogs(wdDialogContentControlProperties).Show Set oFrm = New frmCC If Not isNothing(oCC.PlaceholderText) Then 'trp With oFrm .Caption = oCC.Title .txtPHText = oCC.PlaceholderText .Show End With End If If bCancel Then Exit For Next oCC Unload oFrm Set oFrm = Nothing Else 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?
Comments (0)
Trackbacks (0)
Leave a comment
Trackback