Originally Posted by
macropod
It's not apparent to me why you'd need a separate function, when a ContentControlOnExit macro such as I posted can do the test without one. Even if you want to limit the test to particular content controls, you'd ordinarily build that logic into the self-same ContentControlOnExit macro.
Essentially, I wanted to create a macro button which did the check for specifically titled empty content controls, then display a message box given the user the count for them to review and correct. I know this was not clear in my original question, but I was wanting more of an idea how to accomplish 1 piece of the puzzle without having you solve the whole problem. The hurdle was test boxes that contained no text, but the presence spaces, tabs, returns, were interpreted for populated text. Your replies did just that and I was able to incorporate the trim aspects into my checks and calculations. The result below works for my purpose and I was able to replicate into multiple different "quality" checks, but this is the foundation:
Again, I thank you both!
Private Sub CommandButton1311_Click()
Dim empty_controls As Integer
empty_controls = 0
For Each content_control In ActiveDocument.ContentControls
If content_control.Title = "Finding" And (LTrim(Replace(Replace(Replace(content_control.Range.Text, vbCr, ""), Chr(11), ""), vbTab, "")) = "" Or ShowingPlaceholderText Or content_control.Range.Text = "Click or tap here to enter text.") Then
empty_controls = empty_controls + 1
End If
Next
MsgBox "Please review and correct any issues below:" & vbCr & vbCr & "Blank Findings: " & empty_controls, 0, "Document Integrity Check"
End Sub