Word VisualBasic Script

Sub withTable()
    If Selection.Information(wdWithInTable) = True Then
        'take actions here
    End If
End Sub