Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

https://word.tips.net/T000505_Index_Number_for_the_Active_Table.html

Sub FindTableNumber()
    'https://word.tips.net/T000505_Index_Number_for_the_Active_Table.html
    Dim J As Integer
    Dim iTableNum As Integer
    Dim oTbl As Table

    Selection.Bookmarks.Add ("TempBM")
    For J = 1 To ActiveDocument.Tables.Count
        Set oTbl = ActiveDocument.Tables(J)
        oTbl.Select
        If Selection.Bookmarks.Exists("TempBM") Then
            iTableNum = J
            Exit For
        End If
    Next J
    ActiveDocument.Bookmarks("TempBM").Select
    ActiveDocument.Bookmarks("TempBM").Delete
    MsgBox "The current table is table " & iTableNum
End Sub

  • No labels