Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8169419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:50:37+00:00 2026-06-06T20:50:37+00:00

I have done some quite extensive customisation to the Office 2010 ribbon in Microsoft

  • 0

I have done some quite extensive customisation to the Office 2010 ribbon in Microsoft Word, using a combination of XML, VBA – using the Custom UI Editor.

What I’m trying to establish is that if it’s possible to add a button to the ribbon based on if there is a certain string found in the current file name. For example:

  • If fileName contains “PM” (probably using the InStr method)
  • Add button to ribbon

Any pointers, examples or articles would be much appreciated. I’ve done some digging but haven’t been able to find an appropriate method yet.

I was hoping to use the Onload attribute in the XML to fire the relevant sub that detects the filename and manipulates the ribbon accordingly.

Many thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T20:50:39+00:00Added an answer on June 6, 2026 at 8:50 pm

    Yes. You can change the layout of the Ribbon with VBA during runtime.

    You will have to add the control in the customUI-xml, then add a getVisible-tag within the control that references a VBA-function – you can get the correct signature for the VBA-function from the Custom UI Editor. The function then returns a boolean, True if you want the control to show, and False if not. You can evaluate filename or anything else you want, then return the desired value.

    Example customUI:

    <button id="btnTest" label="Try me" imageMso="FileMarkAsFinal" size="large" supertip="I dare you!" getVisible="GetBtnTestVisible" />
    

    Example VBA:

    'Callback for btnTest getVisible
    Sub GetBtnTestVisible(control As IRibbonControl, ByRef returnedVal)
        'Evaluate and set returnedVal accordingly
        returnedVal = True  'Control visible
        returnedVal = False 'Control hidden
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This should be quite easy, and I have done some research on this. I
Title is quite self explanatory, but I have some animation being done in a
I'm quite new to Android. I have done some work in Java so I
I've done some searching but haven't quite seen the info I'm looking. I have
I have done quite some xCode programming and found the overview perspective of the
I am a quite new to node js and have done some homework in
I have done quite some cocoa-touch stuff, but am still new to cocoa. I
I have done some pretty decent searching and i cant quite fine what im
I'm new to android. I have some java knowledge (not extensive), and I've done
Have done some research and found some stuff that may be helpful. I would

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.