选择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. 点击上面的运行按钮
相关推荐
骆驼爱记录7 天前
WPS页码设置:第X页共Y-1页
自动化·word·excel·wps·新人首发
2301_816997887 天前
Word 清除格式的方法
word
微光feng7 天前
毕业论文word引用操作汇总
word·目录·公式·毕业论文·交叉引用·题注
2301_816997887 天前
Word 功能区与快速访问工具栏
word
halen3337 天前
Hellowordl: The Masters Tool for Word Puzzle Enthusiasts
word
lpfasd1237 天前
Markdown 导出 Word 文档技术方案
开发语言·c#·word
Cxiaomu7 天前
Python 文件解析: Excel / Word / PDF 的解析、处理、预览与下载
python·word·excel
bu_shuo8 天前
Word中插入文本内容控件并交叉引用
word·内容控件
缺点内向8 天前
C#中如何创建目录(TOC):使用Spire.Doc for .NET实现Word TOC自动化
c#·自动化·word·.net
2301_816997888 天前
Word 创建打开与保存文档
c#·word·xhtml