Removing files from Recents List (Excel 2007)
-
- Lounger
- Posts: 47
- Joined: 01 Feb 2016, 08:43
Removing files from Recents List (Excel 2007)
Hi. I am using Excel 2007 and there are items in the Recents List that I would like to remove but can't find a way to do it.
There are no options for doing in the program itself that I can find.
I CAN remove the items from the Excel recent list that appears when right-clicking Excel in the Windows Task Bar, but that does not affect in the list that appears under the in-app File menu.
I searched the registry and found the items, associated with some keys "most recent" keys, but editing and/or removing those keys (after taking a backup) did not remove them from the list. That was a little surprising.
Years ago, I found online a Word template that included an Add-In that lets you remove items in Word's most recent list through a dialog box. I still use that. But I have no idea where I found it, and can't find anything like it for Excel.
Is there anyway to do this in Excel? could it be my version is too old?
Thank you!
There are no options for doing in the program itself that I can find.
I CAN remove the items from the Excel recent list that appears when right-clicking Excel in the Windows Task Bar, but that does not affect in the list that appears under the in-app File menu.
I searched the registry and found the items, associated with some keys "most recent" keys, but editing and/or removing those keys (after taking a backup) did not remove them from the list. That was a little surprising.
Years ago, I found online a Word template that included an Add-In that lets you remove items in Word's most recent list through a dialog box. I still use that. But I have no idea where I found it, and can't find anything like it for Excel.
Is there anyway to do this in Excel? could it be my version is too old?
Thank you!
-
- Lounger
- Posts: 43
- Joined: 07 Jun 2023, 15:34
Re: Removing files from Recents List (Excel 2007)
[Update]
Solve here (sorry copy-paste):
[First test]
Tested this with Excel 2007 (i'm also using), but seems to be to delete the files!:
Reference:
http://www.snb-vba.eu/VBA_Bestanden_en.html
Solve here (sorry copy-paste):
Code: Select all
Sub Clearrecentfiles()
'Update 20140925
On Error Resume Next
Do Until Err.Number <> 0
Application.RecentFiles.Item(1).Delete
Loop
End Sub
Tested this with Excel 2007 (i'm also using), but seems to be to delete the files!:
Code: Select all
Sub test()
Dim i As Integer
With Application.RecentFiles
i = .Count
For i = 1 To .Count
Debug.Print .Item(i).Path
'''''.Item(_i_).Delete
Next i
End With
End Sub
http://www.snb-vba.eu/VBA_Bestanden_en.html
-
- 5StarLounger
- Posts: 607
- Joined: 18 Jan 2022, 15:59
- Location: Re-routing rivers, in Hof, Beautiful Bavaria
Re: Removing files from Recents List (Excel 2007)
Those last two macros seem to work for me in my Excel 2007.
The first one removes the things shown in this list:
The second macro shows me the full path to the things in that list in The Immediate window
Alan
The first one removes the things shown in this list:
The second macro shows me the full path to the things in that list in The Immediate window
Alan
You do not have the required permissions to view the files attached to this post.
I seriously don’t ever try to annoy. Maybe I am just the kid that missed being told about the King’s new magic suit, :(
-
- 4StarLounger
- Posts: 589
- Joined: 14 Nov 2012, 16:06
Re: Removing files from Recents List (Excel 2007)
Code: Select all
Sub M_snb()
Application.RecentFiles.Maximum = 0
End Sub
-
- 2StarLounger
- Posts: 151
- Joined: 11 Jun 2012, 20:37
Re: Removing files from Recents List (Excel 2007)
Although this removes from sight all the entries in the recent files list, they all come back when the .Maximum value is restored.snb wrote: ↑15 Jul 2023, 10:01Code: Select all
Sub M_snb() Application.RecentFiles.Maximum = 0 End Sub
-
- 4StarLounger
- Posts: 589
- Joined: 14 Nov 2012, 16:06
Re: Removing files from Recents List (Excel 2007)
This might be Windows version dependent:
Code: Select all
Sub M_snb()
Kill CreateObject("wscript.shell").SpecialFolders(13) & "\*.*"
End Sub
-
- 5StarLounger
- Posts: 607
- Joined: 18 Jan 2022, 15:59
- Location: Re-routing rivers, in Hof, Beautiful Bavaria
Re: Removing files from Recents List (Excel 2007) or put lots back, that's cool
All interesting stuff….. and I just tried giving it a bigger number than it was, ... and then I could look much further back at the files I had opened a while ago.p45cal wrote: ↑15 Jul 2023, 13:05...this removes from sight all the entries in the recent files list, they all come back when the .Maximum value is restored.snb wrote: ↑15 Jul 2023, 10:01Code: Select all
Sub M_snb() Application.RecentFiles.Maximum = 0 End Sub
That can potentially be a good feature, at least for me with my hap hazard way of storing things: Occasionally I do something quick with a file, somewhere, and forget all about it, and then some time later want to find it.
It’s not a massive list that you seem to be able to get – it seems by me to be set to a limit of 9 in my Excel 2003, and 50 for 2007, 2010 1nd 2013. Still it is an improvement on the standard.
( It looks like it’s the same for Word as well. I have just set that to 50 on a computer that I was very busy on with Word 2013 over the last few months, and that has already been useful to get a better view of what and where I was doing stuff.)
Alan
(P.S. Clearing cookies and using my Bleach Bit does not clear the list)
_.________________________________________________________________________________________________________
You do not have the required permissions to view the files attached to this post.
I seriously don’t ever try to annoy. Maybe I am just the kid that missed being told about the King’s new magic suit, :(
-
- 4StarLounger
- Posts: 565
- Joined: 27 Jun 2021, 10:46
Re: Removing files from Recents List (Excel 2007)
>Kill CreateObject("wscript.shell").SpecialFolders(13) & "\*.*"
Er ... that's the Music folder. The number for the Recent folder is 8.
Er ... that's the Music folder. The number for the Recent folder is 8.
-
- 4StarLounger
- Posts: 589
- Joined: 14 Nov 2012, 16:06
Re: Removing files from Recents List (Excel 2007)
@Speak
Like I said: It is windows version dependent.
Like I said: It is windows version dependent.
-
- 4StarLounger
- Posts: 565
- Joined: 27 Jun 2021, 10:46
Re: Removing files from Recents List (Excel 2007)
Code: Select all
OP's code of 14 Jul 2023, 19:57
Sub test()
Dim i As Integer
With Application.RecentFiles
i = .Count
For i = 1 To .Count
Debug.Print .Item(i).Path
'''''.Item(_i_).Delete
Next i
End With
End Sub
Won't work fine if you are deleting items. The reason is that the moment an item in the list is deleted the list is recalculated. You need to work through the list backwards ...
-
- 4StarLounger
- Posts: 565
- Joined: 27 Jun 2021, 10:46
Re: Removing files from Recents List (Excel 2007)
@snb With respect, SpecialFolders constants (CSIDLs) are fixed, they haven't changed since W95 (sure, new ones have been introduced, and some have had their display names modified, eg My Music -> Music, but if they changed what the constant actually referred to that would break the whole point of the special/known folders system.
The whole point of Special folders is to make it possible for any application to ask the operating system where an appropriate location for certain kinds of files can be found; independently of which version or user language of Windows is being used.
The whole point of Special folders is to make it possible for any application to ask the operating system where an appropriate location for certain kinds of files can be found; independently of which version or user language of Windows is being used.
-
- 4StarLounger
- Posts: 589
- Joined: 14 Nov 2012, 16:06
Re: Removing files from Recents List (Excel 2007)
@speak
You are mistaken.
Apparently you are not familiar with the distinction between these 2 libraries:
CreateObject("shell.application") and CreateObject("wscript.shell")
You are mistaken.
Apparently you are not familiar with the distinction between these 2 libraries:
CreateObject("shell.application") and CreateObject("wscript.shell")
-
- 4StarLounger
- Posts: 565
- Joined: 27 Jun 2021, 10:46
Re: Removing files from Recents List (Excel 2007)
>Apparently you are not familiar with the distinction between these 2 libraries
Ah, but I am - I just read your code too casually, and assumed - because you were using a number - that you were using a CSIDL , rather than in index into a collection. In other words I didn't notice you were using wshShell's SpecialFolders - which, typically, you would access using a string value to avoid the version issue that you mention.
But apologies if you feel I was criticising you.
Ah, but I am - I just read your code too casually, and assumed - because you were using a number - that you were using a CSIDL , rather than in index into a collection. In other words I didn't notice you were using wshShell's SpecialFolders - which, typically, you would access using a string value to avoid the version issue that you mention.
But apologies if you feel I was criticising you.
-
- 4StarLounger
- Posts: 589
- Joined: 14 Nov 2012, 16:06
Re: Removing files from Recents List (Excel 2007)
If you use the string it is language dependent: 'onlangs geopend' <> 'recent', 'bureaublad' <>'desktop'.
It is not an index but a constant.
It is not an index but a constant.