?
Solved

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

Posted on 2016-07-21
5
Medium Priority
?
83 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:Bryce Bassett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 15

Accepted Solution

by:
DrTribos earned 2000 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 15

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:Bryce Bassett
ID: 41732363
Thanks!  Seems similar to the public variable solution I am using, but I'll try your suggestion.
0
 
LVL 15

Expert Comment

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

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

765 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