Re: Office 2007 Ribbon Customization (getPressed)
- From: "Patrick Schmid [MVP]" <pdschmid@xxxxxxxxxxxxxxx>
- Date: Mon, 13 Nov 2006 17:42:09 +0000
Hi Greg,
Can you post your full RibbonX?
The series you read is for B2 and quite a few things have changed since then.
Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80
Office 2007 Beta 2 Technical Refresh (B2TR): http://pschmid.net/blog/2006/09/18/43
***
Customize Office 2007: http://pschmid.net/office2007/customize
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed
"Greg" <gmaxey@xxxxxxxx> wrote in message news:1163432481.339225.136830@xxxxxxxxxxxxxxxxxxxxxxxxxxxx:
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:
>toggleButton id="ToggleButton1" Size="Large"
label="Large Toggle Button"
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.
.
- Follow-Ups:
- References:
- Prev by Date: Office 2007 Ribbon Customization (getPressed)
- Next by Date: Re: Office 2007 Ribbon Customization (getPressed)
- Previous by thread: Office 2007 Ribbon Customization (getPressed)
- Next by thread: Re: Office 2007 Ribbon Customization (getPressed)
- Index(es):