Word 2016 - 如何隐藏重复部分属性菜单中的 'Allow users to add and remove sections' 功能 - VBA?
Word 2016- How to hide the 'Allow users to add and remove sections' feature in the Repeating Sections Properties' menu- VBA?
当文档受到保护时,如何隐藏每个重复部分右下角的“+”按钮,以便用户使用我下面的代码来 insert/add 重复部分?
我的目标是让用户使用宏来添加和删除重复部分。因为在文档受保护时没有简单的方法来删除选定的重复部分,所以我不希望用户因必须单击“+”来添加部分但随后使用位于其他地方的宏来添加部分而感到困惑删除它。
Dim anchor_CC As ContentControl
Set anchor_CC = ActiveDocument.SelectContentControlsByTitle("General").Item(1)
With anchor_CC
.AllowInsertDeleteSection = True
.RepeatingSectionItems(1).InsertItemAfter
.AllowInsertDeleteSection = False
End With
'
End Sub
您不能简单地隐藏“添加”按钮。您需要禁用添加和删除部分。
然后在您的代码中您需要使用内容控件的 AllowInsertDeleteSection
属性 打开和关闭此设置,否则您的代码将无法添加或删除任何项目.
当文档受到保护时,如何隐藏每个重复部分右下角的“+”按钮,以便用户使用我下面的代码来 insert/add 重复部分?
我的目标是让用户使用宏来添加和删除重复部分。因为在文档受保护时没有简单的方法来删除选定的重复部分,所以我不希望用户因必须单击“+”来添加部分但随后使用位于其他地方的宏来添加部分而感到困惑删除它。
Dim anchor_CC As ContentControl
Set anchor_CC = ActiveDocument.SelectContentControlsByTitle("General").Item(1)
With anchor_CC
.AllowInsertDeleteSection = True
.RepeatingSectionItems(1).InsertItemAfter
.AllowInsertDeleteSection = False
End With
'
End Sub
您不能简单地隐藏“添加”按钮。您需要禁用添加和删除部分。
然后在您的代码中您需要使用内容控件的 AllowInsertDeleteSection
属性 打开和关闭此设置,否则您的代码将无法添加或删除任何项目.