Word - is current selection in a Table?

M

Merlin

Hello all

Is there a why of detecting from VB whether a Range in Word is contained in
a table?

Context: I am developing a Word Addin that traverses a Word document,
highlighting (Selecting) each paragraph in turn and allowing the user to
perform certain actions on the selected Range. If it goes to the next
paragraph, and that paragraph is contained in a table, then I want it to
behave differently.
But so far I have not discovered a way to detect is if it is inside a table
or not.

Thanks
Merlin
 
P

Peter Huang [MSFT]

Hi Merlin

I think you may try the approach below.

Sub Test()
Dim rg As Range
Set rg = Selection.Range
MsgBox rg.Information(wdWithInTable)
End Sub



Best regards,

Perter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

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