View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Desktop shortcut to last file that was opened

How did you do this in MSWord? I would have guessed that there wasn't a way.

=====
This may work for you in excel.

It doesn't open the last file that you were working on--but it will open the
first file in the Most Recently Used File list (if you have that turned on).

I'd create a new workbook and put this code in a general module:

Option Explicit
Sub auto_Open()
Dim wkbk As Workbook

Set wkbk = Nothing
On Error Resume Next
Set wkbk = Workbooks.Open(Filename:=Application.RecentFiles(1 ).Path)
On Error GoTo 0

If wkbk Is Nothing Then
MsgBox "Most Recently used file not opened!"
End If

'uncomment this when you're sure it's working ok
'ThisWorkbook.Close savechanges:=False

End Sub

Then put a short cut to this "helper" workbook on your desktop.


If the file has been deleted/renamed/moved, then this will fail.

If you don't have (xl2003's menu):
Tools|Options|General tab|Recently Used File list
turned on, then it will fail.


Dart wrote:

I'm trying to find a way to create a desktop shortcut that will open the last
Excel file I was working on. I have a one for Word but have not been able to
create one for Excel. Does anyone have any suggestions


--

Dave Peterson