首页 > 其他 > 详细

使用word中的宏实现选中指定类型表格,并且批量修改样式结构

时间:2015-01-11 11:01:09      阅读:486      评论:0      收藏:0      [点我收藏+]

使用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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!