Consulting

Results 1 to 8 of 8

Thread: Solved: Hide/Show Ribbon Tab

  1. #1

    Solved: Hide/Show Ribbon Tab

    I was reading through your explanation here to another user:

    vbaexpress_com/forum/showthread.php?t=19686

    When I enter "getVisible=" into my XML for a custom tab, and then re-open my document template I get an error that says:

    "The macro cannot be found or has been disabled because of you Macro security settings."

    Here's a sample of my XML:

    <tab id="CustomTab"label="OMAR" getVisible="something"> 
    
    If I remove the getVisible it opens fine. If I add it back, I get the error.

    What is the big picture I'm missing here. I'm using Word 2007, and I'm referencing the Office 12.0 library.

    I would appreciate any help you could offer.

    Warm regards,
    Dan Yager
    QBA Editor
    quickheads.com

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Doi you have a callback macro called something?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3

    Oh. . .

    What's a callback macro?

    I guess I really am missing the big picture! LOL!

    I did a quick search of these forums for "Callback macro" and see that I need to set-up something like this:

    Sub something(control As IRibbonControl, ByRef returnedVal) .....My VBA here ..... End Sub
    Is this correct? I'm basically looking for the ability to show or hide the TAB programatically.

    I appreciate the help. See sometime I just need a smack to get headed in the right direction.

    Thanks,
    Dan Yager
    QBA Editor
    quickheads.com

  4. #4
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,724
    Location
    Each type of Ribbon element has its own callback format


    The CustomUI editor

    http://openxmldeveloper.org/articles...muieditor.aspx


    has a 'Callback code generator' that you can paste into a module

    It also does some other nifty things, and the price is right

    Paul

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by quickheads
    What's a callback macro?

    I guess I really am missing the big picture! LOL!

    I did a quick search of these forums for "Callback macro" and see that I need to set-up something like this:

    Sub something(control As IRibbonControl, ByRef returnedVal) .....My VBA here ..... End Sub
    Is this correct? I'm basically looking for the ability to show or hide the TAB programatically.

    I appreciate the help. See sometime I just need a smack to get headed in the right direction.

    Thanks,
    Dan Yager
    QBA Editor
    quickheads.com
    So you didn't then

    Because your CustomUI XML is using getVisible you need a getVisible callback, something like


    [vba]

    Sub something(control As IRibbonControl, ByRef returnedVal)

    Select Case control.ID

    Case "CustomTab": returnedVal = True
    End Select
    End Sub
    [/vba]

    But getVisible is only required if at some point you intend to toggle its visibility between True and False. If you want it always visible, just use

    <tab id="CustomTab" label="OMAR" >
    in the XML
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6

    AHA. . .!

    Thanks Paul and XLD,
    I think I'm getting the hang of it now.

    So you didn't then
    I didn't. . . but I do now! (It works A LOT better!) LOL!

    I have a little more playing around to do to toggle the visibility, but your responses have allowed me to move forward! I really appreciate you getting me aimed in the right direction.

    Warm regards,
    Dan Yager
    QBA Editor
    quickheads.com

  7. #7
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Let us know how it goes, and if we can help further.

    BTW, I visited your website, I had never heard of these before, it made an interesting little foray. Pity they are gone now.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  8. #8

    Thanks again. . .

    I got it working beautifully thanks to you all. I was trying to prevent the ribbon from showing to people who were not members of the management team. This involved grabbing their credentials from Active Directory, and then parsing an XML file out on our intranet to see if they met a certain set of parameters. If so, then I make the ribbon visible.

    I had all of the other pieces figured out, I just didn't quite understand the "callback macros" Thanks to you all I was able to put all of the pieces together.

    Thanks for the comment on my website as well. The company that made the kits went out of business in 1985, but the Quickie Builders Association has been continuing to help people finish their planes since 1982! There are lots of planes still under construction (including my own) and we are currently trying to involve new builders by making them completely "scratch buildable." Lot's of good stuff happening.

    You can see my time lapse video construction log here: quickheads.com/construction-log/

    Thanks again,
    Dan Yager
    QBA Editor
    quickheads.com

Posting Permissions

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