View Single Post
 
Old 12-15-2023, 08:29 AM
hss001 hss001 is offline Windows 10 Office 2021
Novice
 
Join Date: Dec 2023
Posts: 20
hss001 is on a distinguished road
Default Selected Text when in a Table - Accessing Sentence

Hi,

my VBA code is running in Excel. It runs a word search in a Word document, and from the results returns the Sentence of each match.

So, the below code works fine if the found text is in a paragraph:

Code:
oWordApp.Selection.Sentences(1)
But, when the found text is in a table it just returns 2 characters - a space and a newline (I think)

I can't figure out how to access the sentence of the current selection, when it's in a table.
Can anyone help?

Thanks
Reply With Quote