MRU(”Most Recently Used”) file list in Excel 2007

Hi all

There is no built-in option to disable the MRU(“Most Recently Used”) file list in the Office button menu.
A few weeks ago Excel guru Jim Rech send me a test file to disable the MRU list in Excel 2007.
After a few test versions I upload the last version from Jim to my site.

Try this example file with XML to create a new tab on the ribbon and hide/disable a few controls
and the VBA code from Jim Rech to disable/hide the MRU list.

Part from the comments in the code from Jim:
Because there is apparently no way to disable the MRU list on the Office Menu directly
we clear it by setting Application.RecentFiles.Maximum to 0. Since this action clears
the MRU list in the registry we first backup its contents to the registry as well
as number of files the user is showing in it. We use the registry in case VB variables are cleared.

Download the example file from my site in the “Ribbon Tips section”

Or the direct link

Please give feedback if you have problems with the code or suggestions.

Tip: check out also the new Add-in from Jim Rech to find the names of all Office 2007 button images
on my site, see point 4.

Ron de Bruin and Jim Rech

Posted in Uncategorized

8 thoughts on “MRU(”Most Recently Used”) file list in Excel 2007

  1. >>But why disable MRU?!?!

    This is in the context of what’s called a ‘dictator app’, a term Rob Bovey, I believe, coined. An Excel dictator application is one that totally takes over the Excel user interface so that the only functionality the user has is what you want him to have. The goal is to make it seem as if the user is not even in Excel but a stand alone program. I’ve been developing such apps for 20 years, starting with Lotus 1-2-3, for my employer for mostly in-house use. It would make no more sense for the user to be able to open an Excel file outside of the user interface while running such an app than it would be in say a chess program.

    MS provided the ‘startFromScratch’ attribute in RibbonX markup just for this reason – to make it easy for Excel developers to remove all of the built-in ribbon in their applications. I assume it was an oversight by MS that they did not make disabling the MRU as part of this.

  2. Hi

    This is a test of I can post a comment to the blog from WinXP.
    It is not possible from my Vista machines the last weeks.

    Good to see the Jim reply

  3. Hi Dick

    No, my first comment (10:40) was send from my Vista machine and
    you now see it after a day.

    I send a few more the last weeks but i not see then in the blog

  4. Since most VBA attempts to hide the MRU list result in the destruction of the list I have resorted to the following. My app processes one workbook, uses an xlam file for ribbon customization for 2007 and vba code for command bar customization for previous versions -so my xls “dictator” file runs in either. I have eliminated almost all user choices, except in 2007 the MRU shows. However if a user selects from the MRU list I use the workbook deactivate event (which will be generated by that action and some others)to re-establish the original command bars and exit the application. Not a great solution but it at least prevents corrupting the app by opening another file. The user probably won’t try that again. This worked for my situation as it preserves the list but prevents its use from screwing up my app.

Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.