选择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. 点击上面的运行按钮
相关推荐
bu_shuo6 小时前
word表格中使用公式
word·表格
不坑老师9 小时前
利用不坑盒子的Copilot,快速排值班表
microsoft·word·powerpoint·excel·copilot·wps
开开心心就好12 小时前
批量PDF转换工具,一键转换Word Excel
开发语言·前端·学习·pdf·电脑·word·excel
RainSerein1 天前
Laravel8中使用phpword生成word文档
word·php·laravel
qq_393828221 天前
办公文档批量打印器 Word、PPT、Excel、PDF、图片和文本,它都支持批量打印。
windows·word·powerpoint·excel·软件需求
_oP_i11 天前
实现 “WebView2 获取word选中内容
开发语言·c#·word
LENG_Lingliang11 天前
word出现由WPS切换后公式异常无法删除的情况处理
word·wps·mathtype
贤和兄11 天前
使用docx4j 实现word转pdf(linux乱码处理)
linux·pdf·word
开开心心就好12 天前
高效批量转换Word到PDF的方法
javascript·安全·智能手机·pdf·word·objective-c·lisp
response_L12 天前
麒麟v10、uos系统在线批量生成pdf文件
java·pdf·word·pageoffice·在线编辑