Determining if a row includes a Content Control

A

Alan

I am working in Word 2007. I want to determine with VBA code
whether or not a selected row of a table contains one or more content
controls in any of the row's cells. I also need to know where they
are.

How can I do this? Thanks, Alan
 
G

Greg Maxey

Something like this:

Sub ScratchMacro()
Dim oRow As Row
Dim oRows As Rows
Dim oCell As Cell
For Each oRow In Selection.Rows
For Each oCell In oRow.Cells
ActiveDocument.Range.InsertAfter "Column: " _
& oCell.Range.Information(wdEndOfRangeColumnNumber) _
& " ContentControl Count: " _
& oCell.Range.ContentControls.Count & vbCr
Next oCell
Next oRow
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top