C
Cooz
Hi everyone,
I've made some customizations to the Word 2007 ribbon - among other things I
have supplied a check box in a group on a custom tab that the user may check
if (s)he wants certain additional functionality enabled.
The onAction callback nicely records the state of the checkbox and stores it
for the current user in an .ini file. An add-in queries this value at startup
and takes appropriate actions. What still doesn't work, however, is having
the checkbox reflect the user's choice when Word starts up - it is always
empty.
The customization xml contains the following:
<checkBox id="chkSCPTab" label="Show options at startup"
getPressed="modRibbon.RetrieveChkSCP" onAction="modRibbon.StoreChkSCP" />
The relevant VBA code snippet:
Sub StoreChkSCP(ByVal control As IRibbonControl, ByRef pressed As Boolean)
System.PrivateProfileString("C:\myIni.ini", "Startup", "ShowOptions") =
Format(pressed)
End Sub
Sub RetrieveChkSCP(ByVal control As IRibbonControl, ByRef pressed As Boolean)
pressed = System.PrivateProfileString("C:\myIni.ini", "Startup",
"ShowOptions")
myRibbon.InvalidateControl control.ID
End Sub
StoreChkSCP gets executed just fine each time I click the checkbox.
RetrieveChkSCP doesn't seem to do anything: starting Word and clicking the
tab that contains the checkbox even coughs up a Type mismatch error. Now why
is that? How can I get the value from the .ini file back in the check box?
Thank you,
Cooz
I've made some customizations to the Word 2007 ribbon - among other things I
have supplied a check box in a group on a custom tab that the user may check
if (s)he wants certain additional functionality enabled.
The onAction callback nicely records the state of the checkbox and stores it
for the current user in an .ini file. An add-in queries this value at startup
and takes appropriate actions. What still doesn't work, however, is having
the checkbox reflect the user's choice when Word starts up - it is always
empty.
The customization xml contains the following:
<checkBox id="chkSCPTab" label="Show options at startup"
getPressed="modRibbon.RetrieveChkSCP" onAction="modRibbon.StoreChkSCP" />
The relevant VBA code snippet:
Sub StoreChkSCP(ByVal control As IRibbonControl, ByRef pressed As Boolean)
System.PrivateProfileString("C:\myIni.ini", "Startup", "ShowOptions") =
Format(pressed)
End Sub
Sub RetrieveChkSCP(ByVal control As IRibbonControl, ByRef pressed As Boolean)
pressed = System.PrivateProfileString("C:\myIni.ini", "Startup",
"ShowOptions")
myRibbon.InvalidateControl control.ID
End Sub
StoreChkSCP gets executed just fine each time I click the checkbox.
RetrieveChkSCP doesn't seem to do anything: starting Word and clicking the
tab that contains the checkbox even coughs up a Type mismatch error. Now why
is that? How can I get the value from the .ini file back in the check box?
Thank you,
Cooz