+ Reply to Thread
Results 1 to 5 of 5

Custom Ribbonx and Setting Visibility of Groups?

  1. #1
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Custom Ribbonx and Setting Visibility of Groups?

    I've learned a ton in the last year, and getting better at searching out my own answers, but currently stuck on this one.

    I have an Excel Addin that includes some customized RibbonX code to create a 'Department' menu of macros (with callbacks) and functions that are specific to my office department.

    Now I want to add to that Department Menu another group, but it should ONLY show when a specific workbook is open. That 'specific' workbook can and will have a different name depending on the user. But I think I should be able to read the Workbook doc properties to work around the file name.

    So, I'm thinking the following, but not sure yet if feasible or not.

    Is it possible to have some sort of Workbook Change event included in your Addin File? And then the Addin File can then set the visibility of a Menu group depending upon what Workbook is open?

    I'm searching around now, both here and the web. But any early help would be great.

    Thanks
    PT

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,419

    Re: Custom Ribbonx and Setting Visibility of Groups?

    You can capture application events in your addin and then execute you ribbon code.
    http://www.cpearson.com/Excel/AppEvent.aspx
    Cheers
    Andy
    www.andypope.info

  3. #3
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Custom Ribbonx and Setting Visibility of Groups?

    Thanks Andy

    I've started experimenting and trying to learn more on Application Events but currently struggling a little.

    I created 2 files, one called TestAppEvents.xlsm and One called Sample.xlsm.

    And in my TestAppEvents.xlsm file I created the following class module. I also included the same code in the ThisWorkbook of the file.

    Please Login or Register  to view this content.
    But currently, when I open up the Sample.xlsm file and try to go back and forth between the two workbooks, I do not see a message.

    Am I even on the right track in learning how to use an application event?

    Edit..... Made a little progress as I was not aware I needed to also first include the below. Now I think I need to learn to set the visibility of the ribbon item.

    Please Login or Register  to view this content.
    Last edited by ptmuldoon; 04-10-2016 at 04:51 PM.

  4. #4
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Custom Ribbonx and Setting Visibility of Groups?

    I have made some progress on this little project, but could possibly now use some help or advice.
    To summarize, I am trying to Show/Hide a specific menu group in a Custom Tab (that is created with Ribbonx) so that it only shows for a specific department workbook. And the workbook file could have many different files name as it based off a department template file.

    I can get the that menu group now to hide and unhide using the App_WorkbookActivate Event and checking on a file name. But when I try to have the WorkbookActivate event read a CustomDocumentProperty it gives an Invalid Procedure Error when I launch Excel.

    I believe the issue is that I need to somehow first check if that CustomDocuementProperty exist before attempting to read its value? But I’m not certain yet on how to do that.
    This is the code used in the App_WorkbookActive

    Please Login or Register  to view this content.
    And I know the CustomDocProp exists as I can debug.print it in the departments template file

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Custom Ribbonx and Setting Visibility of Groups?

    I've been experimenting further, and have found I can get this to work if I use the BuiltInDocumentProperties, but will not work if I try and use a CustomBuiltProperty.

    So this works

    Please Login or Register  to view this content.
    But I try and create a customdocproperty, it will give an error even though the customproperty and value does exist?

    Has anyone come across this before?
    Last edited by ptmuldoon; 04-11-2016 at 04:06 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Custom UI using Ribbonx
    By Beekster in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-06-2016, 06:25 AM
  2. Assistance with Custom Tab and Groups on Excel Office Ribbon using Custom UI Editor.
    By sdavison in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-15-2015, 06:13 AM
  3. Excel Custom RibbonX Label updated from VBA
    By Bezzie in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-06-2013, 08:22 AM
  4. Need help setting up a custom macro!!
    By trow in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-01-2012, 10:02 AM
  5. Setting a trendline with a custom slope and intercept
    By bizarro in forum Excel General
    Replies: 1
    Last Post: 11-12-2011, 07:58 AM
  6. [SOLVED] Checkbox visibility setting fails
    By onyxnz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-20-2011, 12:12 AM
  7. [SOLVED] custom paper size setting
    By Boyd in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 08-26-2005, 02:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1