![]() |
#9
|
|||
|
|||
![]()
Hi @all
I understand you guys are talking of the recentfiles of office, not the one the OS provides.In this case you got the chance to temper with the list's items using the application-object recentfiles. It provides three methods: .Open ---> to check if the file opens (if not an error occurs, and you can handle this one) .Delete ---> to delete the item from the list .Add ---> to add a new item, in this case the same item with the new path The following example assumes that the second item in recentfiles doesn't open, due to a wrong Drive's name. The Drive of the path will be changed, and is added to the list: Code:
Sub ChangeRecentFiles() Dim strPath As String, strName As String Dim strNewDrive As String Dim strNewPath As String, strNewName As String Dim lngFile As Long strNewDrive = "H:" lngFile = 2 strName = Application.RecentFiles.Item(lngFile).Name strPath = Application.RecentFiles.Item(lngFile).Path strNewPath = strNewDrive & Right(strPath, Len(strPath) - 2) On Error GoTo DeleteListItem Application.RecentFiles.Item(lngFile).Open Exit Sub DeleteListItem: Application.RecentFiles.Item(lngFile).Delete Application.RecentFiles.Add Name:=strNewPath strNewName = Application.RecentFiles.Item(1).Path End Sub |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
pluviosilla | Word VBA | 4 | 11-06-2014 05:36 PM |
![]() |
etippelt | Word VBA | 6 | 04-08-2013 05:55 PM |
Programmatically convert Office documents to PDF from C# | hemaneelagiri | Office | 0 | 10-21-2011 06:07 AM |
outlook programmatically read an attachment into byte array | chriskaza81 | Outlook | 0 | 11-19-2010 01:03 AM |
Programmatically changing folder item selection | Richard Cook | Outlook | 0 | 02-09-2007 02:25 PM |