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 for Applications 窗口中,單擊 插入 > 模塊,然後將以下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-超過100種Word高級功能,節省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