How to check if Range is Within a Table using Word VBA?
I was perplexed when LakshmiSatish, a wonderful copyeditor (and a great person) instructed some rules to be applied quite differently when a selected text is within a Table. Hats-off to copyeditors; you guys simply do a great job; I am afraid if the reader will know the hard-work you put. Enough musings! How to check if our Selection.Find is inside a Word Table? The following code makes that easy
Sub Check_If_Selection_Within_Table()
If Selection.Information(wdWithInTable) = True Then
MsgBox "Selection within Table"
Else
MsgBox "Selection outside Table"
End If
End Sub
Really easy isn’t it. There are also some other parts of Text that can be ignored. How ? Bookmarks is an easy way. We will deal with it soon.
No comments:
Post a Comment