Unable to change "Enabled" state of an Excel 2007 ribbon gallery b

Hi folks, Looking for help on this.
If we embed a button inside an excel 2007 ribbon gallery, it is not possible 
to change its "Enabled" state after a workbook is opened and the gallery is 
expanded. Only on workbook open the "getEnabled" callback is successfully 
executed and the proper state is achieved. Following workbook open as well, 
before the gallery is expanded, the state changes successfully. However once 
the gallery is expanded the state cannot be changed.

Buttons that are not embedded in a gallery work just fine.

can be definitely seen on SP0 and SP2.

the xml file to customize the 
ribbon:---------------------------------------------------------------------------------------------------------------

<!-- 	
	Here we have added a button and a gallery  containing a button in the Home 
tab of the excel ribbon.
	 We have grouped them under the "Enable Issue" group.
	The two buttons "Will Change" and "Won't Change" both have the same 
callback corresponding to the "getEnabled" property.
-->

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customUI onLoad="ribbonLoaded" 
xmlns="http://schemas.microsoft.com/office/2006/01/customui">

<ribbon>

     <tabs>

          <tab idMso="TabHome" >

               <group id="RDBGroup2" label="Enable Issue" >
          
                 <gallery id="IssueGallery" imageMso="DateAndTimeInsert" 
                                                                      
label="Expand Me" columns="3" rows="4" onAction="InsertMonth" >

                      <button id="Disobedient" label="Won't Change" 
getEnabled="GetEnabled"  />

                 </gallery>

                 <button id="Obedient" label="Will Change" 
getEnabled="GetEnabled"  />



               </group>

          </tab>
     </tabs>
</ribbon>

</customUI>

The VBA code that calls ribbon.invalidate

Option Explicit

Dim Rib As IRibbonUI
Public Enabled As Boolean

'Callback for customUI.onLoad
Sub ribbonLoaded(ribbon As IRibbonUI)
    Set Rib = ribbon
End Sub

Sub GetEnabled(control As IRibbonControl, ByRef returnedVal)
    returnedVal = Enabled
End Sub
Sub Set_Enabled()
    Enabled = True
    Rib.Invalidate
End Sub
Sub Set_Disabled()
    Enabled = False
    Rib.Invalidate
End Sub
0
Utf
3/19/2010 10:13:01 AM
excel.programming 6508 articles. 2 followers. Follow

4 Replies
913 Views

Similar Articles

[PageSpeed] 37

Hi,

Not sure I follow. You can change the state of the button within the 
gallery by using the Invalidate method you have in your code.
But what I can not see is what you think should be causing the 
Set_Enabled or Set_Disabled routines to run.

I added a routine which you had assigned to the galleries OnAction.
You will need to add an item to the gallery in order to raise the callback.

'---------
Public Sub InsertMonth(control As IRibbonControl, selectedId As String, 
selectedIndex As Integer)
'
' Code for onAction callback. Ribbon control gallery
'
     If Enabled Then
         Set_Disabled
     Else
         Set_Enabled
     End If

End Sub
'---------

The button in the gallery and on the ribbon will now alternate state.

Cheers
Andy

On 19/03/2010 10:13, basso profondo wrote:
> Hi folks, Looking for help on this.
> If we embed a button inside an excel 2007 ribbon gallery, it is not possible
> to change its "Enabled" state after a workbook is opened and the gallery is
> expanded. Only on workbook open the "getEnabled" callback is successfully
> executed and the proper state is achieved. Following workbook open as well,
> before the gallery is expanded, the state changes successfully. However once
> the gallery is expanded the state cannot be changed.
>
> Buttons that are not embedded in a gallery work just fine.
>
> can be definitely seen on SP0 and SP2.
>
> the xml file to customize the
> ribbon:---------------------------------------------------------------------------------------------------------------
>
> <!-- 	
> 	Here we have added a button and a gallery  containing a button in the Home
> tab of the excel ribbon.
> 	 We have grouped them under the "Enable Issue" group.
> 	The two buttons "Will Change" and "Won't Change" both have the same
> callback corresponding to the "getEnabled" property.
> -->
>
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <customUI onLoad="ribbonLoaded"
> xmlns="http://schemas.microsoft.com/office/2006/01/customui">
>
> <ribbon>
>
>       <tabs>
>
>            <tab idMso="TabHome">
>
>                 <group id="RDBGroup2" label="Enable Issue">
>
>                   <gallery id="IssueGallery" imageMso="DateAndTimeInsert"
>
> label="Expand Me" columns="3" rows="4" onAction="InsertMonth">
>
>                        <button id="Disobedient" label="Won't Change"
> getEnabled="GetEnabled"  />
>
>                   </gallery>
>
>                   <button id="Obedient" label="Will Change"
> getEnabled="GetEnabled"  />
>
>
>
>                 </group>
>
>            </tab>
>       </tabs>
> </ribbon>
>
> </customUI>
>
> The VBA code that calls ribbon.invalidate
>
> Option Explicit
>
> Dim Rib As IRibbonUI
> Public Enabled As Boolean
>
> 'Callback for customUI.onLoad
> Sub ribbonLoaded(ribbon As IRibbonUI)
>      Set Rib = ribbon
> End Sub
>
> Sub GetEnabled(control As IRibbonControl, ByRef returnedVal)
>      returnedVal = Enabled
> End Sub
> Sub Set_Enabled()
>      Enabled = True
>      Rib.Invalidate
> End Sub
> Sub Set_Disabled()
>      Enabled = False
>      Rib.Invalidate
> End Sub

-- 

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info

0
Andy
3/19/2010 12:28:31 PM
Thanks Andy,

I should have mentioned that I am explicitly calling the Set_Enabled and 
Get_Enabled macros.
For some reason the onAction callback for the gallery is not getting called 
in my case. 
From some testing, this is what I deduce on how the getEnabled callbacks are 
called for the different buttons. 
(1) For the button outside the gallery it gets called when the ribbon is 
invalidated (Happens properly on my Excel)
(2) For the button embedded in the gallery it gets called when the gallery 
is expanded. In my case the issue seems to be that the callback is called 
only on the first expansion of the gallery. It is not called thereafter. 
Seems to be a systematic issue.
Also, the gallery onAction callback not being called is a little strange. I 
am possibly going wrong somewhere, but I would rather concentrate on (2)
If it is possible could you test it on your side?

Regards.
0
Utf
3/23/2010 7:04:01 AM
I will investigate further if you can email an example file. That way I 
will not have to guess or make assumptions about what you actually have 
setup.

andy AT andypope DOT info

Cheers
Andy

On 23/03/2010 07:04, basso profondo wrote:
> Thanks Andy,
>
> I should have mentioned that I am explicitly calling the Set_Enabled and
> Get_Enabled macros.
> For some reason the onAction callback for the gallery is not getting called
> in my case.
>  From some testing, this is what I deduce on how the getEnabled callbacks are
> called for the different buttons.
> (1) For the button outside the gallery it gets called when the ribbon is
> invalidated (Happens properly on my Excel)
> (2) For the button embedded in the gallery it gets called when the gallery
> is expanded. In my case the issue seems to be that the callback is called
> only on the first expansion of the gallery. It is not called thereafter.
> Seems to be a systematic issue.
> Also, the gallery onAction callback not being called is a little strange. I
> am possibly going wrong somewhere, but I would rather concentrate on (2)
> If it is possible could you test it on your side?
>
> Regards.

-- 

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info

0
Andy
3/23/2010 8:37:15 AM
Thanks Andy,

I have sent a sample workbook to your email.

Regards.

"Andy Pope" wrote:

> I will investigate further if you can email an example file. That way I 
> will not have to guess or make assumptions about what you actually have 
> setup.
> 
> andy AT andypope DOT info
> 
> Cheers
> Andy
> 
> On 23/03/2010 07:04, basso profondo wrote:
> > Thanks Andy,
> >
> > I should have mentioned that I am explicitly calling the Set_Enabled and
> > Get_Enabled macros.
> > For some reason the onAction callback for the gallery is not getting called
> > in my case.
> >  From some testing, this is what I deduce on how the getEnabled callbacks are
> > called for the different buttons.
> > (1) For the button outside the gallery it gets called when the ribbon is
> > invalidated (Happens properly on my Excel)
> > (2) For the button embedded in the gallery it gets called when the gallery
> > is expanded. In my case the issue seems to be that the callback is called
> > only on the first expansion of the gallery. It is not called thereafter.
> > Seems to be a systematic issue.
> > Also, the gallery onAction callback not being called is a little strange. I
> > am possibly going wrong somewhere, but I would rather concentrate on (2)
> > If it is possible could you test it on your side?
> >
> > Regards.
> 
> -- 
> 
> Andy Pope, Microsoft MVP - Excel
> http://www.andypope.info
> 
> .
> 
0
Utf
3/23/2010 1:01:01 PM
Reply:

Similar Artilces:

Unable to Open Mailbox after account was Disabled and Re-enabled
I disabled a users account in Active Directory because he was fired. Now need to get in the mailbox to retrieve some e-mails. So I Enable the account in Active Directory and reset the users password. I login to the network fine but when I try to open the mailbox with Outlook I get this error. "Cannot start Microsoft Outlook. Unable to open the Outlook window. The set of folders could not be opened." I checked the security everything is correct. It is like his mailbox is still disabled or something? Please help me! Thank you, Scott_Conti@hotmail.com How many domain controlle...

Mail Enabled AD objects
I am currently working in a test lab with Exchange 2003 installed on the same computer with Windows 2003 which is also a DC. I am migrating user accounts from another Windows NT 4.0 domain. Everytime I migrate an account to the new AD Domain it automatically creates a mail enabled object for the user account. Is there any way to turn that off? Thanks Ross Are you using ADMT? I think there's an option in ADMT to create mailboxes. Not 100% sure but doublecheck. -- This posting is provided "AS IS" with no warranties, and confers no rights. Please do not send email to this ...

Mail Enabled Public Folder Hidden Email address
Hi, I am running SBS 2003 w Exchange. We create public folders on the fly for different projects, and then we want to copy emails to them. By default however, the address is Hidden from Exchange Address Lists, and we can't email to the folder, until I go into ESM and change the properties, and clear that checkbox. Is there a way to change the default so the address is not hidden, and we can email to the folder by default? Thanks Willy On Wed, 14 Feb 2007 13:08:20 -0800, WillyinPhoenix <WillyinPhoenix@discussions.microsoft.com> wrote: >Hi, I am running SBS 2003 w Exchan...

Excel 2002 Crashes When Enabled Macros & on Save Event
we have excel worksheet with macros, we validate data using vba macros regular expressions and update cell colors based on validaty of the data. in some of our machines on certain user profiles whenever we save it excel is crashing. we changed font color & background, it seemed to work little, but entering into debug mode at message box level. Not sure what causing this problem, same spreadsheet works in other machine with the same version? Please let me know what areas I can look into to fix this problem. ...

Mail Enabled user not showing up in GAL.
We've recently migrated from a stand-alone Exchange 2K server to an Exchange 2K3 Enterprise Edition clustered server. The users mailboxes were moved from the old stand-alone to the new clustered server with no errors. After the move, we have one account that does not show up in the global address list (GAL). The user is mail-enabled and has an email address as well as all the requisite permissions on said mailbox. However, if I log in as this user, I'm unable to setup an Outlook profile because the system cannot resolve the name to one in the GAL. I can see the users mailbox in ...

Can't use .NET MessageBox in /CLR enabled MFC project?
I have a /clr enabled MFC project. When I want to use #using <System.Windows.Forms.dll> ..... System::Windows::Forms::MessageBox::Show("Some Message"); I get an error error C2653: 'MessageBoxA' : is not a class or namespace name so what is wrong here? thanks. WJ "WJ" <WJ@discussions.microsoft.com> wrote in message news:F8DB9571-8204-428C-B0A2-B8687E970E36@microsoft.com... >I have a /clr enabled MFC project. When I want to use > > #using <System.Windows.Forms.dll> > > .... > System::Windows::Forms::MessageBox::Show(&qu...

icon background is not transparent when aero is enabled in vista
hello, all: i meet a curious thing. i make a icon using vc2005, and the backgournd of icon is transparent. i draw it to a dialog. in xp, it is right, the backgournd is transparent. but when aero is enabled in vista, the background is wrong, change into white. i find a way to solve this i get the dialog 's dc ,and create a bitmap. draw icon on the bitmap, and then draw bitmap to dialog's dc. the code like below int lWidth = rtClient.right - rtClient.left; int lHeight = rtClient.bottom - rtClient.top; RECT rcWindow; ::GetWindowRect(hDestWindowOverride, &rcWindow); HDC...

Select Text with Similar Formatting is not enabled
In Word 2007, I have several instances of text formatted with small caps. I should be able to click inside one of the formatted words and from the Select menu, Select Text with Similar Formatting. However, that option is greyed out / disabled. Does anyone know why and what the fix is? Thank you! I found the answer: Keep Track of Formatting must be enabled in Word Advanced Options. "Trudy" wrote: > In Word 2007, I have several instances of text formatted with small caps. I > should be able to click inside one of the formatted words and from the Select ...

Restrict Mail Enabled Public folder
I am using a mail enabled public folder as the journaling mailbox. Typically a mailbox would be created in a separate mailbox store but this is not possible in Exchange SBS Premium 2003. So I need to restrict the ability to send mail directly to the public folder and only accept mail that comes from the archive in the mailbox store where I have journaling enabled. If you use a mailbox for journaling, as in exchange enterprise edition, This would be achieved in the delivery restrictions of the user properties by clicking only from and selecting the journaling mailbox user. But with public folde...

Time enabled Macros
Hi Is there anyway that you can activate a macro so it runs every 15 minutes, I have an written some code that takes an outlook body and places this in an excel workbook(test.xls) say a1,b1,c1,d1. I have then recorded a macro that then pulls that data through and pastes it as a row in my workbook(get_data) but I need to automate this process to run every 15 minutes. I hav einclude the code I have used belo Sub get_data( 'copy the dat ChDir "C:\ Workbooks.Open Filename:="C:\TEST.XLS Range("A1:d1").Selec Selection.Cop 'get the paste range for all of ...

Sharepoint e-mail enabled document library
Was this option taken away or hidden in the Sharepoint that powers the Business Portal? Thanks. -Joe ...

InterOrg with Mail Enabled accounts
We have multiple Exchange 2003 orgs in a test environment. I am trying to configure InterOrg to replicate Free/Busy info between the orgs. All of doc's talk about the need of contacts in both orgs to be able to replicate the free/busy info (I was able to do that successfully). The question here, can I use mail enabled accounts instead of contacts in both orgs to replicate free busy info? ...

Exchange 2003 and outlook 2003 with cache mode enabled
Help please, We have just done a Group policy to enable Exchange 2003 cache mode. We are about to upgrade all office users to Office 2003 from 2000 so we decided to do this. The GPO was done last night and we already have a number of users who have office 2003 but did not have cache mode turned on. This morning we noticed it was taking some of the users forever to see their mail as it was caching the local copy for the first time. Also our Exchange server appears to be a bit slow. We have a 65 Gig store and many mailboxes over 300-400 Mb in size. Some have heaps of items in thei...

Mail Enabled Public Folder #3
Is there any way to prevent a public folder from being mail enabled by default? This is getting really annoying... Also, is there a way to Un-mail-enable a PF? We are running Exchange 2003 on Windows 2003 (SBS 2003 Premium) TIA, Carlos. "Carlos M. Perez" <cperez@nospamruncentralnospam.com> wrote: >Is there any way to prevent a public folder from being mail enabled by >default? This is getting really annoying... Is the Exchange organization running in "mixed" or "native" mode? A mixed-mode organization will mail-enable public folders by dfaul...

Mailbox enabled user
When I create a user in Active directory It does not get set up properly for Exchange. When I do the ADSI edit and do properties on the user the showinaddressbook is not setup. I have done the trouble shooting of the RUS, I have re-setup/install( x:\i386\setup domainprep) a domainprep but nothing I do seems to help. I could use soom help!!! Thank You addition to message: I think the problem maybe related to the fact that I install exchange 2003 as a test in our domain. Then I installed the production version on a new server in our domain and then had to delete the test installatio...

Publisher 2007 Color Printing option not enabled
I'm trying to get the best possible printing of my picture on postcards (marketing material). When I upgraded to 2007 the quality improved. I notice that the "Tools", "Commercial Printing Tools" "Colot Printing" option is not enabled. What's it for and why is it not enabled? My printing is very slow with Mail Merge from Excel (55 seconds per page of 4 postcards), but I will post that separately. Thanks. Anyone? "Howard" wrote: > I'm trying to get the best possible printing of my picture on postcards > (marketing material)....

Using Distribution Groups or Mail-enabled Security Groups
We've upgraded from Exchange 5.5 w/SP4 and Distribution Lists to a new Exchange 2003 w/SP1 server, and were wondering if there is any advantage or disadvantage as to what type of Group to use to replace our Distribution Lists? Our ADS Domain is Windows 2003, if that makes any difference. Thanks. Exchange 5.5 Distribution Lists map to AD/Exchange 200x Distribution Groups. It's a good idea to use those in most cases since they're not security principals. Not a good idea to reveal security group memberships to users/anonymous senders, imo. -- Bharat Suneja MCSE, MCT www....

compile warnings on CArray with 64-bit warnings enabled
All declarations of a CArray seem to give a compile warning similar to the following: C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxtempl.h(1773) : warning C4244: 'initializing' : conversion from 'DWORD_PTR' to 'DWORD', possible loss of data C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsimpstr.h(387) : while compiling class-template member function 'void CMap<KEY,ARG_KEY,VALUE,ARG_VALUE>::Serialize(CArchive &)' with [ KEY=CString, ARG_KEY=LPCTSTR, ...

Creating "auto-reply" trigger for email enabled public folders
Is there a good tutorial for creating a script that will automatically send an email response to anyone who submits an item into a email enabled public folder? Thanks, Rob G. In news:%23vYqlVt$GHA.4808@TK2MSFTNGP03.phx.gbl, Rob Gordon <Robert.Gordon@nospam.dslextreme.com> typed: > Is there a good tutorial for creating a script that will > automatically send an email response to anyone who submits an item > into a email enabled public folder? > > Thanks, > > Rob G. Take a look at Folder Assistant - http://www.msexchange.org/tutorials/Public-Folder-Basics-Part...

Mail Enabled Public Folder Limits
I am currently using the Exchange Standard Edition that came with my SBS server 2003 premium. I have service pack 2 installed. My question is regarding a mail enabled public folder that currently has in its properties in system manager the "Age Limits For Replicas" set for 1 day. I know this is going to sound weird but I need the mail that arrives in that folder to be purged immediately or as fast as possible. Is there any way of speeding this up faster than the limit Microsoft sets at a minimum of one day? I need to use this folder for this purpose and no other folder type will do ...

Do you need a license for mail enabled contacts?
We have roughly 75 Custom Recipients in our 5.5 organization and I have made up user accounts in NT and forwarded them to the outside address. My question is in Exchange 2003 do I need to have a license for each mail enabled contact to accomplish this. Thanks in advance. Dwayne why did you create NT accounts for custom recipients? Custom recipients are for external addresses...they do not need NT accounts... "Dwayne" <no@no.com> wrote in message news:ecQnebrNEHA.3380@TK2MSFTNGP11.phx.gbl... > We have roughly 75 Custom Recipients in our 5.5 organization and I have mad...

Read / Unread Problem in mail enabled Public Folder
Hi! I've got a problem with our the "Maintain per-user read and unread information for this folder" -function on our mail enabled public folders. First, i disabled the checkbox "Maintain per-user read and unread.." in the properties of a public folder. this worked without a problem for over one week. Then, i disabled the checkbox on a seconde public folder. the next day, all new incoming messages on both public folders remained in the unread-status, even when they were opened! i enabled the "Maintain per-user read and unread.."-checkbox on a public fo...

Script Mail Enabled User
Hi, I wrote the script below to query a excel spreadsheet to create mail enabled users in AD. The script appears to work fine, but for some reason when I e-mail the mailbox I get a bounce back saying "A configuration error in the e-mail system caused the message to bounce between two servers or to be forwarded between two recipients. Contact your administrator." The actual account works fine as I can log onto the NT account and open the mailbox. Sending messages also works fine. If anyone has any ideas please point me in the right direction. Script On Error Resum...

auto row height a cell with wrap text enabled and a lot of charact
How do I auto row height cells that have been wrap text enabled to work correctly? Scenario is: from a word document I copy and paste the text into an excel 2007 spreadsheet. The cells are wrap formatted and the column width narrowed, manually, to enable them to fit to A4 paper. Some cells can have as many as 900 characters. Problem is: the cells auto row height adjusts to the number of characters but it is cropped and missing some text when print view or printed? I have tried various formats of the cell alignment but still no good! Is there a solution as to how I get around this? ...

MFC App unable to run in Vista with UAC enabled
Application Description: The Application is a MFC C++ unmanaged code application, which utilizes Visual Studio .Net 2003 to compile and InstallShield Version 12 to deploy. The application is intended to be installed on the following Operating Systems: Windows 2000 sp4; Windows XP sp2; and Windows Vista. Problem Description: On Windows Vista, once installed the application executes as expected one or two times then a failure occurs for every execution thereafter. The security feature UAC, User Access Control, is enabled before and after installation, and the installation is performed using ...