标签:
使用word中的宏实现选中指定类型表格,并且批量修改样式结构
Sub SelectAllTables() ' ' 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 With tempTable.Columns(1).Cells(1).Range.Find .Text = "名称" .Forward = True .Execute If .Found = True Then 'MsgBox "找到类容" tempTable.Range.Editors.Add wdEditorEveryone End If End With Next '选中所有可编辑区域 ActiveDocument.SelectAllEditableRanges wdEditorEveryone '删除所有可编辑的区域 ActiveDocument.DeleteAllEditableRanges wdEditorEveryone Application.ScreenUpdating = True 'For i = 1 To ActiveDocument.Tables.Count ' ActiveDocument.Tables(i).Style = "我的格式" 'Next End Sub
使用word中的宏实现选中指定类型表格,并且批量修改样式结构
标签:
原文地址:http://blog.csdn.net/z249683156/article/details/42607961