选择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. 点击上面的运行按钮
相关推荐
寒山李白5 小时前
解决 python-docx 生成的 Word 文档打开时弹出“无法读取内容“警告
python·word·wps·文档·docx·qoder
AI进化营-智能译站17 小时前
ROS2 C++开发系列01:在ROS2上编写第一个C++ hello word
开发语言·c++·ai·word
gc_22992 天前
学习C#调用OpenXml操作word文档的基本用法(30:学习日期相关类)
word·openxml·日期
gc_22992 天前
学习C#调用OpenXml操作word文档的基本用法(28:学习文本类)
word·文本·text·openxml
2501_907136822 天前
HandyWrite Pro - word/excel转手写工具
word·软件需求
Eiceblue2 天前
C# 如何实现 Word 转 Excel ?分享两种实用方法
c#·word·excel
天才少女爱迪生2 天前
word格式规范检测+自动修改【python】
python·c#·word
gc_22992 天前
学习C#调用OpenXml操作word文档的基本用法(29:学习中断类)
word·中断·openxml·break
梅孔立2 天前
Aspose.Words Java 表格动态删列、合并列、表头重建、全局字体统一解决方案
java·开发语言·word·aspose·在线编辑
爱叨叨的小嘟3 天前
Latex公式 转 word可编辑公式
word·typora·latex