选择word中的表格VBA

  1. 打开开发工具

  2. 选择Visual Basic

  3. 插入代码

    Sub 选择word中的表格()
    Dim t As Table
    an = MsgBox("即将选择选区内所有表格,若无选区,则选择全文表格。", vbYesNo, "提示")
    If an - 6 Then Exit Sub
    Set rg = IIf(Selection.Type = wdSelectionIP, ActiveDocument.Content, Selection.Range)
    ActiveDocument.DeleteAllEditableRanges wdEditorEveryone
    For Each t In rg.Tables
    t.Range.Editors.Add wdEditorEveryone
    Next
    ActiveDocument.SelectAllEditableRanges wdEditorEveryone
    ActiveDocument.DeleteAllEditableRanges wdEditorEveryone
    End Sub

  1. 点击上面的运行按钮
相关推荐
weixin_4166600718 小时前
AI 生成复杂公式在 Word 中乱码的原因与解决方案
ai·word·数学公式
缺点内向18 小时前
Word 自动化处理:如何用 C# 让指定段落“隐身”?
开发语言·c#·自动化·word·.net
。puppy2 天前
SQL 注入整理
数据库·sql·word
gc_22992 天前
学习C#调用OpenXml操作word文档的基本用法(20:学习嵌入文件类)
c#·word·openxml·嵌入文档
Eiceblue2 天前
Vue文档编辑器(Word默认功能)示例
前端·vue.js·word
DS随心转小程序2 天前
deepseek导出word
人工智能·chatgpt·edge·word·deepseek·ds随心转
gc_22993 天前
学习C#调用OpenXml操作word文档的基本用法(19:学习文档页脚类)
c#·word·openxml·页脚·footerpart
ooope3 天前
Deepseek如何生成word或excel文件?
word·excel
码农水水3 天前
米哈游Java面试被问:机器学习模型的在线服务和A/B测试
java·开发语言·数据库·spring boot·后端·机器学习·word
萧炎火4 天前
word另存为html后用浏览器打开不显示图片
word