选择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. 点击上面的运行按钮
相关推荐
gsls20080836 分钟前
使用xdocreport导出word
前端·python·word
空中湖1 天前
免费批量PDF转Word工具
pdf·word
开开心心就好1 天前
免费PDF转图片软件
javascript·智能手机·pdf·flask·word·excel·scikit-learn
空中湖2 天前
免费批量Markdown转Word工具
word·markdown
呆萌的代Ma2 天前
Cursor实现用excel数据填充word模版的方法
word·excel
空中湖3 天前
文档极速转换器 - 免费批量Word转PDF工具
pdf·word
东方佑3 天前
使用 Python 自动化 Word 文档样式复制与内容生成
python·自动化·word
wqqqianqian5 天前
国产linux系统(银河麒麟,统信uos)使用 PageOffice在线编辑word文件保存数据同时保存文件
linux·word·信创·国产·保存·pageoffice·在线编辑
余子桃5 天前
Python实现markdown文件转word
python·word·markdown
一只特立独行的兔先森5 天前
WordZero:让Markdown与Word文档自由转换的Golang利器
golang·word·word自动化