Range contains full table rows?

A

Alex

Hello,

What's the best way to find whether a range (or selection) contains only table rows (and possibly, non-table text)?

Thanks,
Alex.
 
A

Alex

The formulation of the question was very confused.

Basically, I wanted to know whether the selection encompassed only complete table rows (including end-of-row markers).

Here's my solution:

Public Function OnlyCompleteRows(rng As Range) As Boolean
OnlyCompleteRows = False
If rng.Information(wdWithInTable) And rng.Information(wdStartOfRangeColumnNumber) = 1 Then
Dim rng2 As Range
Set rng2 = Selection.Characters.Last
rng2.Collapse(wdCollapseStart)
If rng2.Information(wdAtEndOfRowMarker) Then
OnlyCompleteRows = True
End If
End If
End Function

Can it be optimized?


Best wishes,
Alex.
 

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