将光标落在一个table中,如何用vb语言得到这个table的序号?就是ActiveDocument.Tables(X)的这个X是多少?谢谢!

解决方案 »

  1.   

    以前答过的http://topic.csdn.net/t/20060304/13/4592398.html
    Sub Macro1()
        Dim i As Integer
        For i = 1 To ActiveDocument.Tables.Count
            If Selection.InRange(ActiveDocument.Tables(i).Range) Then Exit For
        Next
        MsgBox IIf(i > ActiveDocument.Tables.Count, "No   tables   are   selected!", "tables(" & i & ")   is   selected!")
    End Sub
      

  2.   

    以前答过的http://topic.csdn.net/t/20060304/13/4592398.html
    Sub Macro1()
        Dim i As Integer
        For i = 1 To ActiveDocument.Tables.Count
            If Selection.InRange(ActiveDocument.Tables(i).Range) Then Exit For
        Next
        MsgBox IIf(i > ActiveDocument.Tables.Count, "No   tables   are   selected!", "tables(" & i & ")   is   selected!")
    End Sub
      

  3.   

       Dim i As Integer
        For i = 1 To ActiveDocument.Tables.Count
            If Selection.InRange(ActiveDocument.Tables(i).Range) Then Exit For
        Next
        MsgBox IIf(i > ActiveDocument.Tables.Count, "No   tables   are   selected!", "tables(" & i & ")   is   selected!")
    End Sub
      

  4.   

    word中表格的索引时按照自上而下排列的跟插入顺序无关,第一个表格的索引就是1,如此类推。