PDA

View Full Version : Workbooks.Open ... AddToMru:=True



malik641
07-02-2007, 05:11 PM
Hey all,

I've just stumbled upon this and wondered if anybody uses this? For those who don't know, the AddToMru parameter is (from the help files):


AddToMru:
True to add this workbook to the list of recently used files. The default value is False.
It adds any file you open programmatically to the list under the File menu at the very bottom if you set that variable to True. Is it me or do we never mention that when we help somebody open a file by code? Why would anybody not use this? And why is the default value False?

I guess I just feel like it's a good option to know about and, to me, would probably be considered a good practice if we include this in our code. What do you guys think?

Bob Phillips
07-03-2007, 12:28 AM
Why would they use it? When opening a file in VBA, you are controlling it from an application, and it is unlikely that the user would want to open this from Excel themselves, if they did it would already be in the MRU.

In all the apps I have written, I have NEVER seen the need to add the file to the MRU. The closest I came was an app where I created its own MRU, not affectinf Excel's.

And don't forget, if you add to the MRU, one of the current files gets lopped off.

malik641
07-03-2007, 08:06 AM
One reason that I would use it is to make an application look more seamless. If any file you open within Excel gets added to the MRU, why not from some automated code? And you're right, if they wanted to look at a workbook it could already be in the MRU, but it may not necessarily be there if they opened enough workbooks to bump it outta there. I guess it would depend from application to application.

A small example (probably not the best): If you had an app that only held data (say you controlled the data entry by userform), but could open a report workbook from that data workbook, you could add it in the MRU if it wasn't there. Chances are users would normally look at the report workbook anyway, so adding it to the MRU could just be an extra perk if they haven't opened it recently.

lucas
07-03-2007, 08:25 AM
Joseph, I honestly never use the most recent list and know very few folks that do....I guess if it were in a case where it was being used regularly it could make a difference.

Bob Phillips
07-03-2007, 09:02 AM
I do Steve, loads. And I admit, I get real grumpy when I lose a key file from the lits, so guess how I would react if some d*#n VBA added a file and bumped the one I wanted.

Norie
07-03-2007, 09:08 AM
Joseph

I agree with xld - I wouldn't want anybody messing with my MRU list.

I mean it's bad enough when Excel does it.:)

malik641
07-03-2007, 09:19 AM
And I admit, I get real grumpy when I lose a key file from the lits, so guess how I would react if some d*#n VBA added a file and bumped the one I wanted. :rotlaugh:

I use it a lot, too. I actually originally got the idea because I use the MRU list in CorelDraw and I have hyperlinks in my Excel file to open the drawings I've worked on, but it doesn't add the file to the MRU list in CorelDraw. And that's when I thought about it. I chose to put this in Excel cause everyone hangs around here :cool:

Norie, xld,
Do you guys use/have MSO 2007? I love their new feature of "Pinning" a file in the MRU list! :yes Never have to worry about being bumped out again!

Bob Phillips
07-03-2007, 09:40 AM
Norie, xld,
Do you guys use/have MSO 2007? I love their new feature of "Pinning" a file in the MRU list! :yes Never have to worry about being bumped out again!

Yeah, I do, and I agree it is another nice feature.

The whole MRU seems tidier in 2007.