Word 2016-如何在 VBA 中添加/删除重复节内容控件 [英] Word 2016- How to add/delete Repeating Section Content Control in VBA

查看:52
本文介绍了Word 2016-如何在 VBA 中添加/删除重复节内容控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试编写 vba 代码来添加和删除特定命名的 RSCC 的重复项部分.

Trying to write vba code to add and delete repeating item section for specifically named RSCC.

下面的代码可以添加但是不知道如何删除

The following code works for adding but cannot figure out how to delete

是否可以添加使用 VBA 重复部分内容控制部分?

推荐答案

要删除特定命名的 RSCC 的重复项部分,只需编辑您在另一个问题中找到的代码.

To delete repeating item section for specifically named RSCC just edit the code you found in the other question.

Set cc = ActiveDocument.SelectContentControlsByTitle("RepCC").Item(1)
'to delete the first RepeatingSectionItem
cc.RepeatingSectionItems.Item(1).Delete
'to delete all but the first RepeatingSectionItem
Dim index As Long
For index = cc.RepeatingSectionItems.Count To 2 Step -1
  cc.RepeatingSectionItems.Item(index).Delete
Next index
'to delete the entire ContentControl
cc.Delete

这篇关于Word 2016-如何在 VBA 中添加/删除重复节内容控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆