G
Greg
Hello,
I am dabbling with customization of the Office 2007 Ribbon. I have
read the series of articles at MSDN on Customizing the Office (2007)
Ribbon UI for Developers. I have some questions about the purpose,
use, and coding of the the toggleButton attribute "getPressed."
For practice, I used the example customization XML provided in the part
1 of the article. It adds a custom tab with a toggle button the XML
for the togglebutton is:
getPressed="ThisDocument.MyToggleMacro"
onAction="ThisDocument.MyActionMacro" />
In part 2 of the article it states that the getPressed attribute is of
the callback type and enables you to specify whether the toggle button
control is pressed.
I have the following VBA code in myPractice.dotm file
Sub MyActionMacro (ByRef control as IRibbonControl)
MsgBox "TestMyAction")
End Sub
Sub MyToggleMacro (ByRef control as IRibbonControl)
MsgBox "TestMyToggle"
End Sub
Now when I open myPractice.dotm the custom tab appears. When I click
on the tab, the VBA editor throws an error indicating I have the wrong
number of arguments. I click ok, and my custom ribbon then appears
with the toggle button. If I "press" it, then I get the message box
"TestMyAction"
I never get the message TestMyToggle, and if I subsequently select
another tab and then the custom tab again, I don't get a repeat of the
error. (Note, if I close and reopen the file I do get the error the
first time I click the custom tab).
It appears, that pressing the custom tab the first time fires the
MyToggleMacro and that is supposed to set the initial condition of the
toggle.
Is that assumption correct?
How do I code the MyToggleMacro such that it contains the right number
of arguments and then sets the toggle to either of its two states?
Thanks.
I am dabbling with customization of the Office 2007 Ribbon. I have
read the series of articles at MSDN on Customizing the Office (2007)
Ribbon UI for Developers. I have some questions about the purpose,
use, and coding of the the toggleButton attribute "getPressed."
For practice, I used the example customization XML provided in the part
1 of the article. It adds a custom tab with a toggle button the XML
for the togglebutton is:
label="Large Toggle Button"toggleButton id="ToggleButton1" Size="Large"
getPressed="ThisDocument.MyToggleMacro"
onAction="ThisDocument.MyActionMacro" />
In part 2 of the article it states that the getPressed attribute is of
the callback type and enables you to specify whether the toggle button
control is pressed.
I have the following VBA code in myPractice.dotm file
Sub MyActionMacro (ByRef control as IRibbonControl)
MsgBox "TestMyAction")
End Sub
Sub MyToggleMacro (ByRef control as IRibbonControl)
MsgBox "TestMyToggle"
End Sub
Now when I open myPractice.dotm the custom tab appears. When I click
on the tab, the VBA editor throws an error indicating I have the wrong
number of arguments. I click ok, and my custom ribbon then appears
with the toggle button. If I "press" it, then I get the message box
"TestMyAction"
I never get the message TestMyToggle, and if I subsequently select
another tab and then the custom tab again, I don't get a repeat of the
error. (Note, if I close and reopen the file I do get the error the
first time I click the custom tab).
It appears, that pressing the custom tab the first time fires the
MyToggleMacro and that is supposed to set the initial condition of the
toggle.
Is that assumption correct?
How do I code the MyToggleMacro such that it contains the right number
of arguments and then sets the toggle to either of its two states?
Thanks.