Last active
July 26, 2022 07:19
-
-
Save kinuasa/933704d379de7b2ed24e13fb1ad89c19 to your computer and use it in GitHub Desktop.
[リボン・カスタマイズ]checkBoxのオン・オフを動的に変更する 関連Tweet:https://twitter.com/kinuasa/status/1409399077935058944
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'標準モジュール | |
Option Explicit | |
Private myRibbon As Office.IRibbonUI | |
Private flgChkSample As Boolean | |
Private Sub rbnSample_onLoad(ribbon As IRibbonUI) | |
Set myRibbon = ribbon | |
flgChkSample = True | |
End Sub | |
Private Sub btnSample_onAction(control As IRibbonControl) | |
flgChkSample = Not flgChkSample | |
'myRibbon.Invalidate 'リボン全体再描画 | |
myRibbon.InvalidateControl "chkSample" 'コントロール指定で再描画 | |
MsgBox flgChkSample | |
End Sub | |
Private Sub chkSample_getPressed(control As IRibbonControl, ByRef returnedVal) | |
returnedVal = flgChkSample | |
End Sub | |
Private Sub chkSample_onAction(control As IRibbonControl, pressed As Boolean) | |
flgChkSample = pressed | |
MsgBox flgChkSample | |
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="rbnSample_onLoad"> | |
<ribbon> | |
<tabs> | |
<tab id="tabSample" label="Sample Tab"> | |
<group id="grpSample" label="Sample Group"> | |
<button id="btnSample" label="Sample Button" size="large" imageMso="HappyFace" onAction="btnSample_onAction" /> | |
<checkBox id="chkSample" label="Sample CheckBox" getPressed="chkSample_getPressed" onAction="chkSample_onAction" /> | |
</group> | |
</tab> | |
</tabs> | |
</ribbon> | |
</customUI> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment