View Single Post
 
Old 01-15-2023, 08:54 PM
AlanCantor AlanCantor is offline Windows 10 Office 2019
Competent Performer
 
Join Date: Nov 2020
Posts: 154
AlanCantor is on a distinguished road
Default Select a table in Word

I'm trying to develop a script to select an entire table in Word, but only if the insertion point (cursor) is within the table. If the insertion point is NOT within a table, I want the script to signal an error.


I have a working prototype, but it's not quite right. The code selects just one column, not the entire table.

Sub SelectThisTable()

On Error GoTo ErrorHandler

Selection.SelectColumn

' Do something with the selected table

Exit Sub
ErrorHandler:

MsgBox "Not in a table"
End Sub
Reply With Quote