可以使用宏来更改Word中ActiveX控件的属性吗?
我有一个工作表,上面有多个可填充字段(Activex控件 - 文本,下拉列表,日期等),并且本质上希望该表格转向两个方。第一方将填补大部分领域。然后,我想更改控件的属性以锁定内容进行编辑,因此,当发送到第二方时,他们只能回答其余的“开放”字段。
我记录了一个宏更改每个ActiveX控件的属性,以便在将表单准备共享时,第一个用户将不必在将文档发送到第二方之前手动更改30个字段。
当我运行宏时,我会收到一个错误:“运行时错误'91':对象变量或块变量未设置”
您可以记录宏以更改Word中的ActiveX控件的属性,如果是,我在做什么错误的?在此先感谢您的帮助!
'
' RestrictActiveXControls Macro
' Restrict editing on all ActiveX Developer Controls in the Standardized MAFES Hay Form.
'
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
End Sub```
I have a worksheet with multiple fillable fields (ActiveX Controls-- text, drop-down, dates, etc.) and essentially want the form to go to two parties. The first party will fill in a majority of the fields. Then I want to change the property of the controls to lock the content for editing, so when sent to the second party, they can only answer the remaining 'open' fields.
I recorded a macro changing the property of each ActiveX Controls so that when the form is ready to share, the first user would not have to manually change 30 something fields before sending the document to the second party.
When I run the macro I get an error: "Run-time error '91': Object variable or With block variable not set"
Can you record macros to change the property of ActiveX Controls in Word, and if so, what am I doing wrong? Thanks in advance for helping!
'
' RestrictActiveXControls Macro
' Restrict editing on all ActiveX Developer Controls in the Standardized MAFES Hay Form.
'
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
Selection.ParentContentControl.LockContents = True
End Sub```
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有发表评论所需的声誉(因此,我只能通过更改此帖子来重新评论您的评论),但是...
如果您使用ActiveX控件,则您所拥有的代码将无效,因为它引用了内容。控件 - 例如,您有
(即控件类型错误)
I do not have the reputation needed to comment (and so I can only respnd to your comments by changing this post), but...
...If you are using ActiveX Controls, the code you have will not work because it references Content Controls - for example, you have
(i.e. the wrong type of control)