2,462
社区成员
发帖
与我相关
我的任务
分享
Sub test()
Dim t1 As Object
Dim t2 As Object
Dim i As Integer
If Selection.Information(wdWithInTable) = True Then
Set t1 = Selection.Tables(1)
For i = 1 To ActiveDocument.Tables.Count
Set t2 = ActiveDocument.Tables(i)
If t1 = t2 And t1.Range.End = t2.Range.End Then
MsgBox "这是tables(" & i & ")"
End If
Next
Else
MsgBox "光标不在表内"
End If
End Sub
Sub test()
Dim t1 As Object
Dim t2 As Object
Dim i As Integer
If Selection.Information(wdWithInTable) = True Then
Set t1 = Selection.Tables(1)
For i = 1 To ActiveDocument.Tables.Count
Set t2 = ActiveDocument.Tables(i)
If t1 = t2 Then
MsgBox "这是tables(" & i & ")"
End If
Next
Else
MsgBox "光标不在表内"
End If
End Sub