Solved

VBA - How to retrieve current dropdown setting in custom MS Office Ribbon menu

Posted on 2016-07-21
5
43 Views
Last Modified: 2016-07-27
Working in Microsoft PowerPoint 2010, I have a custom ribbon menu (toolbar), and I'm using dropdown controls.  I want the user to be able to select a search keyword, which they narrows down the graphics that appear on a dropdown gallery in the button next to it.

Currently I have an onAction macro associated with the dropdown that changes a public variable each time the dropdown is changed.  then the gallery button filters based on that public variable.  How do I accomplish this without relying on a public variable?.  In other words, when the user hits the gallery button, I'd like it to read the current setting of the ribbon dropdown and create the filtered set at that time.  

Appreciate any pointers.
0
Comment
Question by:versatilebb
  • 3
5 Comments
 
LVL 23

Expert Comment

by:JSRWilson
ID: 41723469
You need to post both the XML code and the vba callback.
0
 
LVL 14

Accepted Solution

by:
DrTribos earned 500 total points
ID: 41723803
You can use Get Let Set approach with a Private Variable, so the dropdown would set the private variable and from there you invalidate the ribbon.  When the ribbon is invalidated it resets.  Change the getItem code for the Gallery Callback to include / exclude items based on the variable.

Other approaches, instead of a variable you can use a document property or spreadsheet cell.

Rory Archibald is credited with the solution for ribbon loss of state problem that uses spreadsheet cell. Google that.

Greg Maxey has great tutorials on the Ribbon, which should include "invalidate"

HTH
0
 
LVL 14

Expert Comment

by:DrTribos
ID: 41723806
Oh... if using MS Word... definitely use a document variable to store the ribbon pointer handle as per Rory solution if you're not already doing that (that by the way is not quite related to the original question but well worth the effort).
0
 

Author Closing Comment

by:versatilebb
ID: 41732363
Thanks!  Seems similar to the public variable solution I am using, but I'll try your suggestion.
0
 
LVL 14

Expert Comment

by:DrTribos
ID: 41732365
Doc variable is non volatile, that'd be the main difference
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show you how to use shortcut menus in the Access run-time environment.
In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now