通过选中和取消选中Checkbox Content Control触发的事件 [英] Events triggered by checking and unchecking a Checkbox Content Control

查看:479
本文介绍了通过选中和取消选中Checkbox Content Control触发的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows中使用Word 2016。我已经设置了一个包含一些复选框的表单,我希望取消选中"事件"。其中一个触发了表单中其他地方的更改。我使用了一个函数:
$


Private Sub Document_ContentControlOnEnter(ByVal ContentControl As ContentControl)


捕获OnEnter事件这似乎工作正常。但是,一旦我选中了复选框,我就可以检查并取消选中它而不会触发此事件(因为控件已经"输入")。


我有没有办法捕获一些事件,表明复选框值已经改变而不需要离开然后重新输入复选框?


谢谢


比尔

解决方案

您正在寻找onChange事件。

 

Private Sub Document_ContentControl_Change()
'每当ContentControl的内容发生变化时调用。打印"现在的价值" + ContentControl.value

End Sub




I am using Word 2016 in Windows. I have set up a form that has some checkboxes and I would like to have an uncheck "event" in one of them trigger changes elsewhere in the form. I have used a function:

Private Sub Document_ContentControlOnEnter(ByVal ContentControl As ContentControl)

to capture the OnEnter event and this appears to be working fine.However once I have selected the checkbox, I can then check and uncheck it without triggering this event (because the control has already been "entered").

Is there a way for me to trap some event that indicates that the checkbox value has been changed without the need to leave and then re-enter the checkbox?

Thanks

Bill

解决方案

You are looking for the onChange event.

Private Sub Document_ContentControl_Change() 'This is called whenever the content of ContentControl changes
debug.print "The value is now " + ContentControl.value

End Sub



这篇关于通过选中和取消选中Checkbox Content Control触发的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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