Note: The other languages of the website are Google-translated. Back to English
登陆  \/ 
x
or
x
点此注册  \/ 
x

or

如何在Word文档中选择所有表?

单击Word中的一个表很容易 点选择表符号 表格左上角的按钮,如下图所示。 您也可以使用“选择表”功能选择一个表。 但是,有什么方法可以在Word文档中一次快速选择所有表吗? 本文中的方法将帮助您理解它。 


使用VBA代码选择Word中的所有表

使用Kutools for Word轻松选择Word中的所有表


使用VBA代码选择Word中的所有表

1。 按 其他 + F11 键打开 Microsoft Visual Basic应用程序 窗口。

2。 在开幕 Microsoft Visual Basic应用程序 窗口中,单击 插页 > 模块,然后将以下VBA代码复制并粘贴到“模块”窗口中;

VBA代码:选择当前文档中的所有表:

Sub selecttables()
Dim mytable As Table

For Each mytable In ActiveDocument.Tables
mytable.Range.Editors.Add wdEditorEveryone
Next
ActiveDocument.SelectAllEditableRanges (wdEditorEveryone)
ActiveDocument.DeleteAllEditableRanges (wdEditorEveryone)
End Sub

3。 按 F5 运行代码的关键

然后,立即在当前文档中选择所有表。


使用Kutools for Word轻松选择Word中的所有表

与使用VBA代码选择文档中的所有表相比,Kutools for Word的 选择表 实用程序非常方便。 您可以使用此功能选择所选内容或整个文档中的表格。 请执行以下操作:

Kutools for Word :拥有100多个方便的Word加载项, 60天免费试用.

单击 Kutools > > 选择表。 看截图:

备注:要在选择中选择表,需要先选择范围,然后再应用功能。

然后,您可以看到如下结果。

在选择中选择表:

在整个文档中选择表:

如果您想免费试用该实用程序,请转到 免费下载软件 首先,然后按照上述步骤进行操作。


演示:使用Kutools for Word轻松选择Word中的所有表




推荐的Word生产力工具

 

Kutools For Word-Word超过100种高级功能,可节省50%的时间

  • 复杂和重复的操作可以在几秒钟内完成一次处理。
  • 跨文件夹一次将多个图像插入Word文档。
  • 将文件夹中的多个Word文件合并并合并为所需顺序。
  • 根据标题,分节符或其他条件将当前文档拆分为单独的文档。
  • 在Doc和Docx之间,Docx和PDF之间转换文件,用于常见转换和选择的工具集合等...

Say something here...
symbols left.
You are guest
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Alex · 4 years ago
    It seeems that this macros does not work in Word 2016
    • To post as a guest, your comment is unpublished.
      Suril · 4 years ago
      It works in Word 2016. What error are you getting?
      • To post as a guest, your comment is unpublished.
        Alex · 4 years ago
        I understand already.
        For correct work macros cursor must to be not in table when you call macros.
        Thank you.
  • To post as a guest, your comment is unpublished.
    Iqbal · 4 years ago
    There are multiple tables in a document (about 200). I want to select all these tables only and paste them in a new document in the table format. When I select the tables as per above procedure then during paste operation it pastes them as text and not as table. Can you please help me?
  • To post as a guest, your comment is unpublished.
    Suril · 4 years ago
    The following modified code selects all tables, except tables having only one row:
    Sub SelAllTbls()
    ActiveDocument.DeleteAllEditableRanges (-1)
    Dim Tbl As Table
    For Each Tbl In ActiveDocument.Tables
    If Tbl.Rows.Count > 1 Then
    Tbl.Range.Editors.Add (-1)
    End If
    Next
    ActiveDocument.SelectAllEditableRanges (-1)
    ActiveDocument.DeleteAllEditableRanges (-1)
    End Sub

    The following code select only the header rows:
    Sub selallHeaders()
    On Error Resume Next
    ActiveDocument.DeleteAllEditableRanges (-1)
    Dim Tbl As Table
    For Each Tbl In ActiveDocument.Tables
    Tbl.Rows(1).Range.Editors.Add (-1)
    Next
    ActiveDocument.SelectAllEditableRanges (-1)
    ActiveDocument.DeleteAllEditableRanges (-1)
    End Sub

    I have many more such codes that select last rows, all bullets, small / long paras, etc. Watch my following video:
    https://www.youtube.com/watch?v=p_ZhufliFw8
  • To post as a guest, your comment is unpublished.
    Vinoth Murali · 4 years ago
    Wonderful I got the solution by using the VBA code. Thank you so much
  • To post as a guest, your comment is unpublished.
    JPF · 5 years ago
    Nifty code at first but it definitely corrupted a bunch of tables in Word 2010. Screwed up my file pretty good and had to revert back to an earlier version. Be wary!
  • To post as a guest, your comment is unpublished.
    rodrigo · 6 years ago
    excellent macro and very easy
  • To post as a guest, your comment is unpublished.
    refaat · 7 years ago
    thank you so much
    he is good program but after few days stopped and require password and user name