word2010中表格怎么全选

如题所述

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、关闭后此时文档中所有表格都已选中。

温馨提示:答案为网友推荐,仅供参考