在word中怎么一次选中所有表格

如题所述

1、点开你需要表格调整的word文档,切换到视图,点击宏。

2、在弹出的对话框中输入宏的名字可以是英文,然后点击创建按钮。

3用下面代码替换掉原有默认内容

Sub 表格()


    Dim tempTable As Table


        Application.ScreenUpdating = False


    '判断文档是否被保护


    If ActiveDocument.ProtectionType = wdAllowOnlyFormFields Then


        MsgBox "文档已保护,此时不能选中多个表格!"


        Exit Sub


    End If


    '删除所有可编辑的区域


    ActiveDocument.DeleteAllEditableRanges wdEditorEveryone


    '添加可编辑区域


    For Each tempTable In ActiveDocument.Tables


        tempTable.Range.Editors.Add wdEditorEveryone


    Next


    '选中所有可编辑区域


    ActiveDocument.SelectAllEditableRanges wdEditorEveryone


    '删除所有可编辑的区域


    ActiveDocument.DeleteAllEditableRanges wdEditorEveryone


    Application.ScreenUpdating = True


End Sub

4、替换之后点击运行按钮,之后关闭宏编辑。

5、关闭后此时文档中所有表格都已选中。

温馨提示:答案为网友推荐,仅供参考
第1个回答  2017-06-03
1.ALT+F8,打开宏对话框,创建名为SelectAllTables的宏。代码如下:
Sub SelectAllTables()
Dim tempTable As Table

Application.ScreenUpdating = False

2. '判断文档是否被保护
If ActiveDocument.ProtectionType = wdAllowOnlyFormFields Then
MsgBox "文档已保护,此时不能选中多个表格!"
Exit Sub
End If
3.'删除所有可编辑的区域
ActiveDocument.DeleteAllEditableRanges wdEditorEveryone
4.'添加可编辑区域
For Each tempTable In ActiveDocument.Tables
tempTable.Range.Editors.Add wdEditorEveryone
Next
'选中所有可编辑区域
ActiveDocument.SelectAllEditableRanges wdEditorEveryone
'删除所有可编辑的区域
ActiveDocument.DeleteAllEditableRanges wdEditorEveryone

Application.ScreenUpdating = True

End Sub本回答被网友采纳
第2个回答  2019-12-31
ctrl+a,,或者鼠标移动到表格上会看到一个十字,点一下就选定了,多选的时候需要按ctrl进行选择,不然只能选一个~~
相似回答