Open last document viewed

D

Don Pullem

When I open Excel how do I get it to display the last document I looked at
when I last closed it.

Thx

Don
 
R

Roger Govier

Hi Don

Go to Files, and in the recently used Files list, the last file used
should be the top item.
 
D

Don Pullem

I guess I wasn't clear. When I open Excel I want it to show the last
document that I had open when I last closed Excel. I don't want to have to
go to files and select the most recent file.

Thx

Don
 
B

Beege

Don,

Well, you could "save workspace" in your XLStart directory. That way
whatever files you had open would re-open next session...

Beege
 
D

Dana DeLouis

See if this idea will work. Place this code on a module sheet in a workbook
named "Book.xlt".
This file is saved to your XLSTART folder.

Sub Auto_Open()
Application.RecentFiles(1).Open
End Sub
 
D

Dave Peterson

Just a thought...

I'm not sure I would have used book.xlt. This is the template file that excel
uses whenever you click on that New icon on the standard toolbar (and the
template that is used when excel starts up).

It'll do what you want, but each workbook that is created that is based on this
template file will have that macro in it. That means whenever you open one of
those files, the first file on that MRU list will be opened.

And if you share any of these workbooks with others, then those users will get
that macro, too.

I think I'd either put it in my Personal.xls file (also stored in XLStart) or a
dedicated workbook (Named OpenMRU.xls (?)) stored in that same XLStart folder.

If you use the dedicated workbook, you could modify Dana's code so that the
workbook closes itself, too:

Sub Auto_Open()
Application.RecentFiles(1).Open
Thisworkbook.close savechanges:=false
End Sub
 
Top