懒人WORD
一、常用宏
打开宏快捷键:ALT+F8
1.1 一键选中所有表格
应用场景:
- word内容太多,表格也很多,但格式又不统一,一个个调太麻烦,怎么办呢?
- word突然抽风,所有表格都失去了边框,怎么办呢?
就一键选中所有表格吧!
- 打开宏: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
- 运行宏
1.2一键选中所有图片
Sub SelectAllPictures()
Dim oShape As Shape
For Each oShape In ActiveDocument.Shapes
If oShape.Type = msoPicture Then
oShape.Select msoTrue
End If
Next
End Sub
【懒人技巧持续挖掘中……】