How to remove listed shortcuts for deleted Excel files?

D

Dave

I use XP Pro, and Office 2007.

In Excel, there are several deleted Excel files. These file shortcuts
persist on my "quick access" file list on opening Excel. Is there a "quick &
easy" way to remove these shortcuts?

Thanks!

-- Dave
 
J

Jim Rech

Open NotePad and paste this script in. Save it to your desktop with a VBS
extension like UpdateXL12MRU.VBS

Close Notepad and then double-click the file.


Rem Removes nonexistent files from XL12's MRU list

dim wsh, fso, Res, Counter, Ptr, FName, delCount
on error resume next
set wsh = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
for counter = 1 to 50
res = wsh.RegRead("HKCU\Software\Microsoft\Office\12.0\Excel\File MRU\Item
" & Counter)
Ptr = instr(1,res,"*",1)
if Ptr > 0 then
FName = Mid(res,Ptr + 1)
if Not fso.FileExists(FName) Then
delCount = delCount + 1
wsh.RegDelete "HKCU\Software\Microsoft\Office\12.0\Excel\File MRU\Item "
& Counter
end if
end if
next
if delCount = "" then
Msgbox "No file names removed from MRU list"
else
Msgbox delCount & " file name(s) removed from MRU list"
end if
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top