繁体   English   中英

如何使用VBA识别word文档中的现有表格?

[英]How to identify an existing table in word document using VBA?

有人可以帮助我识别已经使用 VBA 导入到 Excel 的 Word 文档中的现有表格。

Word 有一个可以单步执行的 Tables 集合。 在一个表中有一个 Cell 集合来标识单元格。 所以在Word中你可以写

Sub test()
Dim t As Table
     For Each t In ActiveDocument.Tables

          If Left(t.Cell(1, 1).Range.Text, 8) = "This One" Then
              MsgBox "Found It!"
              t.Select
          End If
     Next t
End Sub

在每个表的左上角搜索文本“This One”。 这有帮助吗?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM