wps 运行宏 获取所有的表格

1、 需求: 需要修改word里面的表格样式,表格大概有几百个

  1. wps 不支持批量处理,需要使用到宏,下面这个是从其他页面找到的获取所有的表格

测试可以使用。步骤 复制下面的代码到: WPS的工具 --》 开发工具 --》VB编辑器

复制代码
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

3: 如果WPS之前没有装过宏相关的工具就需要先去下载

下载地址:: https://pan.baidu.com/s/1vpq51bAKQPhfbKpC2GzwjA?pwd=1ace 提取码: 1ace

相关推荐
jameszjd2 天前
解决WPS word主选项卡审阅栏消失问题
word·wps
rgbhi2 天前
VSTO WPS调试注册列表
wps
wtsolutions2 天前
JSON导入WPS表格,JSON转wps,json2wps, WPS 插件使用指南
json·wps·wtsolutions
secondyoung2 天前
WPS宏使用:一键批量调整图片与表格格式
经验分享·word·lua·markdown·wps·vb
wtsolutions2 天前
WPS另存为JSON,WPS导出JSON, WPS表格转换成JSON : Excel to JSON WPS插件使用指南
json·excel·wps·插件·加载项·wtsolutions
【ql君】qlexcel3 天前
WPS单元格满足条件时自动变色,单元格值大于某值变色
wps·条件格式·单元格·变色
lifallen4 天前
Word/WPS 制表位分析:如何设置公式居中和编号右对齐
word·wps
wtsolutions4 天前
JSON转Excel工具新增WPS插件功能,将JSON转换成WPS表格工作表数据
json·excel·wps·插件·转换·加载项·wtsolutions
wtsolutions5 天前
Excel to JSON by WTSolutions 4.0.0 版本更新公告
json·excel·wps·插件·转换·加载项·wtsolutions
wtsolutions5 天前
Excel to JSON by WTSolutions 4.0.0 Update Announcement
json·excel·wps·addin·wtsolutions·conversion