ALT+F8,開啟宏對話方塊,建立名為SelectAllTables的宏。程式碼如下:
Sub SelectAllTables()
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
Application.ScreenUpdating = True
End Sub
儲存完成後選擇載入該宏即可。
ALT+F8,開啟宏對話方塊,建立名為SelectAllTables的宏。程式碼如下:
Sub SelectAllTables()
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
儲存完成後選擇載入該宏即可。