Consulting

Results 1 to 13 of 13

Thread: Questions from a customUI newbie

  1. #1
    VBAX Contributor
    Joined
    May 2008
    Posts
    198
    Location

    Questions from a customUI newbie

    I just started to work with a custom UI for my Word document, and I have a few questions.

    I was able to set up a quick test that worked to remove all of the tabs and create a custom tab using 'ribbon startFromScratch="true"', but the Table tools content tabs (Design/Layout) still show up. Is there a way to prevent them from appearing as well?

    Is there a way to add a complete group from the original ribbon? I tried adding the 'GroupZoom' to my custom tab in the xml, but it just added a blank group.

    I tried opening my document on a Mac, but it didn't alter the ribbon. Is the customUI a Windows only functionalit, or is there something different that has to be done for a Mac? The program I have created is intended for PCs, but if I need to make it available to Macs, I would like to know what options I have (if any).

    Are there any options in the xml to show/hide or enable/disable elements based on any conditionals? (e.g. software version, platform, macro-enabled status). I believe that I can use VBA to make further changes to the ribbon, but can this be done from the xml code as well?

    Are there any good thorough tutorials that anyone can suggest?
    Last edited by Cosmo; 10-03-2013 at 01:32 PM.

  2. #2
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,778
    Location
    You cannot alter the Mac ribbon, nor can you use conditionals in the XML - you have to use callbacks.
    I'm not sure about the contextual tabs and startFromScratch.

    Edit: have a read of this page: http://msdn.microsoft.com/en-us/libr...ContextualTabs

    For general Ribbon information, it is worth reading Ron de Bruin's Ribbon/QAT pages here: http://www.rondebruin.nl/win/section2.htm
    Last edited by Aflatoon; 10-04-2013 at 03:19 AM. Reason: Add some more information
    Be as you wish to seem

  3. #3
    VBAX Contributor
    Joined
    May 2008
    Posts
    198
    Location
    Quote Originally Posted by Aflatoon View Post
    You cannot alter the Mac ribbon, nor can you use conditionals in the XML - you have to use callbacks.
    I'm not sure about the contextual tabs and startFromScratch.

    Edit: have a read of this page: http://msdn.microsoft.com/en-us/libr...ContextualTabs
    Cool, a quick glance looks like that is what I am looking for. Thanks.

    Quote Originally Posted by Aflatoon View Post
    For general Ribbon information, it is worth reading Ron de Bruin's Ribbon/QAT pages here: http://www.rondebruin.nl/win/section2.htm
    Thanks for the link, I'll check that out later when I have time.

    Another question: Is there a non-VBA way to display a dialog when one of my custom buttons is clicked? The user needs to allow macros to use my document, and if their security setting is set to disable all macros, I'd like to be able to give them an alert. I have doubts that this could be done within the xml, so alternately I may set a custom group that displays text alerting them to check their settings, along with a button to open the Macro Security settings.

  4. #4
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,778
    Location
    Without VBA you can only use the built-in buttons, I'm afraid.
    Be as you wish to seem

  5. #5
    VBAX Contributor
    Joined
    May 2008
    Posts
    198
    Location
    Quote Originally Posted by Aflatoon View Post
    Without VBA you can only use the built-in buttons, I'm afraid.
    Ok, thanks.

    I was able to get the contextual tabs hidden using the following:
    <contextualTabs>
    <tabSet idMso="TabSetSmartArtTools" visible="false"/>
    <tabSet idMso="TabSetChartTools" visible="false"/>
    <tabSet idMso="TabSetTextBoxTools" visible="false"/>
    <tabSet idMso="TabSetWordArtTools" visible="false"/>
    <tabSet idMso="TabSetDiagramTools" visible="false"/>
    <tabSet idMso="TabSetOrganizationChartTools" visible="false"/>
    <tabSet idMso="TabSetPictureTools" visible="false"/>
    <tabSet idMso="TabSetPictureToolsClassic" visible="false"/>
    <tabSet idMso="TabSetTableTools" visible="false"/>
    <tabSet idMso="TabSetHeaderAndFooterTools" visible="false"/>
    <tabSet idMso="TabSetEquationTools" visible="false"/>
    <tabSet idMso="TabSetInkTools" visible="false"/>
    </contextualTabs>
    I appreciate all the help, thanks!

  6. #6
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,778
    Location
    You're welcome.
    Be as you wish to seem

  7. #7
    VBAX Contributor
    Joined
    May 2008
    Posts
    198
    Location
    One last question: From what I've been reading, there's no way to access the ribbon controls directly through VBA, only through callbacks (e.g. getVisible="MyMacroName"). I was originally hoping I could show a warning (using a labelControl) to alert the user that the macros were not enabled, but if the getVisible callback doesn't run, it's value is automatically false, and the control doesn't appear. Is there a way to do a boolean inverse (I tried getVisible !="MyMacroName", but of course that wouldn't work), or to otherwise set the value to the opposite of the callback value? I am beginning to think that this is not possible; at best, I could only enable/show a contro when the macros are enabled. The same would be true for using 'getLabel' to set the label's caption.

  8. #8
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,778
    Location
    It is possible to access the ribbon through VBA using the accessibility objects interface but it's pretty convoluted and if VBA is disabled anyway, that's not really going to help you.

    If you're using Excel there's an article in the KB here about prompting users to enable macros, but I don't know how you enforce it in other applications.
    Be as you wish to seem

  9. #9
    VBAX Contributor
    Joined
    May 2008
    Posts
    198
    Location
    Quote Originally Posted by Aflatoon View Post
    It is possible to access the ribbon through VBA using the accessibility objects interface but it's pretty convoluted and if VBA is disabled anyway, that's not really going to help you.
    Thanks, I'll look into that. It may do what I need (assUming I can access a specific ribbon element directly through a VBA macro), the issue is that I want to display a label when the macros are disabled. I cannot use the getVisible callbacks (since the value will be false when the macros are disabled, I could only set the visiblity true when they are enabled). If I could either make them invisible, or set their label to an empty string, through a macro, this may do what I need.

    Quote Originally Posted by Aflatoon View Post
    If you're using Excel there's an article in the KB here about prompting users to enable macros, but I don't know how you enforce it in other applications.
    I'll check around to see if there's any other discussion of enforcing macros for Word.

    Thanks again for all of your help.


    Edit: 'convoluted' was a pretty accurate description. I found a demo which will select a specific element on the ribbon, and run it's action, but I'm having a hard time determining if it's possible to change their visibility or text, and if so, how to do it.
    Last edited by Cosmo; 10-08-2013 at 06:22 AM.

  10. #10
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,778
    Location
    Quote Originally Posted by Cosmo View Post
    I want to display a label when the macros are disabled...If I could either make them invisible, or set their label to an empty string, through a macro
    The bold part is the issue I was getting at.
    Be as you wish to seem

  11. #11
    VBAX Contributor
    Joined
    May 2008
    Posts
    198
    Location
    Quote Originally Posted by Aflatoon View Post
    The bold part is the issue I was getting at.
    Yes, but I'm not trying to set them when the macros are active, I'm trying to remove them:

    Add the label control in the xml, set properties to label="Macros are disabled", visibility="True".
    Use a macro to make the label invisible or clear their label on startup.
    If the macros are disabled, the label isn't set to invisible or cleared, thus is only 'visible' when the macros are disabled.

  12. #12
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,778
    Location
    Sorry - that was foolish of me. You would require accessibility for that I think or perhaps use the macros to load another document with the real ribbon customisation in it.
    Be as you wish to seem

  13. #13
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,778
    Location
    This will give you an idea of the accessibility route: http://www.wordarticles.com/Shorts/R...bonVBADemo.php
    Be as you wish to seem

Posting Permissions

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