Iba*_*ola 4 vba ribbon ms-office
我使用xml(使用Microsoft Office的自定义UI编辑器)在功能区中添加了一个复选框.该exec vba代码.即使我关闭应用程序,我也需要此复选框来维护值(已选中或未选中).现在,当我关闭并打开它时,checkBox似乎总是未选中.
我还需要知道是否可以使用vba来确认是否选中了此复选框
为了简化,这是你应该做的.您需要决定如何返回或存储值.是否使用XML/Registry/CustomXML等等.一旦确定,请执行以下步骤.
功能区XML:
<checkBox id="cbStoreValue" label="MyCheckBox" getPressed="Function_Clicked" onAction="Function_Action" />
Run Code Online (Sandbox Code Playgroud)
VBA代码:
Public Function Function_Clicked(control As IRibbonControl, ByRef pressed)
pressed = GetKey
End Function
Public Function Function_Action(control As IRibbonControl, pressed As Boolean)
Store pressed
End Function
Public Sub Store(value As Boolean)
'''write the code for storing the key, may be to an ini file, or registry or an external xml, custom xml or custom document property
End Sub
Public Function GetKey() As Boolean
'''write the code for getting the key back from the source which you might have used to store the value.
'''return the correct value here
GetKey = True ' or whatever you have selected previously
End Function
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助 :)
维卡斯B.
| 归档时间: |
|
| 查看次数: |
6206 次 |
| 最近记录: |