Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Good morning, all,
One of my applications disables the recently used file list, but when I re-enable it, all its entries are lost. Is there any way in which I can store the filenames in the list to an array, then restore them later on? Thanks in advance Pete |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Peter:
Other method,delete ThisWorkbook.FullName in RecentFiles list With ThisWorkbook For Ndx = 1 To Application.RecentFiles.Count If Application.RecentFiles(Ndx).Path = .FullName Then Application.RecentFiles(Ndx).Delete Exit For End If Next Ndx End With -- 天行健,君*以自強不息 地勢坤,君*以厚德載物 http://www.vba.com.tw/plog/ "Peter Rooney" wrote: Good morning, all, One of my applications disables the recently used file list, but when I re-enable it, all its entries are lost. Is there any way in which I can store the filenames in the list to an array, then restore them later on? Thanks in advance Pete |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Good morning, ChiJanZen
Well, at least I understand the object collection that I need to refer to, but I can't get it to work at the moment. Even MsgBox (Application.RecentFiles(1)) doesn't display an empty message box. I'm stumped. Pete doesn't display anything - not even the messagebox "chijanzen" wrote: Peter: Other method,delete ThisWorkbook.FullName in RecentFiles list With ThisWorkbook For Ndx = 1 To Application.RecentFiles.Count If Application.RecentFiles(Ndx).Path = .FullName Then Application.RecentFiles(Ndx).Delete Exit For End If Next Ndx End With -- 天行健,君*以自強不息 地勢坤,君*以厚德載物 http://www.vba.com.tw/plog/ "Peter Rooney" wrote: Good morning, all, One of my applications disables the recently used file list, but when I re-enable it, all its entries are lost. Is there any way in which I can store the filenames in the list to an array, then restore them later on? Thanks in advance Pete |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Peter:
doesn't display an empty message box. MsgBox (Application.RecentFiles(1).Path) or Dim Recent As Variant Sub test() ReDim Recent(Application.RecentFiles.Count) For Each f In Application.RecentFiles Recent(I) = f.Path I = I + 1 Next ' Application.RecentFiles.Maximum = 0 For I = 0 To UBound(Recent) MsgBox Recent(I) Next I End Sub -- 天行健,君*以自強不息 地勢坤,君*以厚德載物 http://www.vba.com.tw/plog/ "Peter Rooney" wrote: Good morning, ChiJanZen Well, at least I understand the object collection that I need to refer to, but I can't get it to work at the moment. Even MsgBox (Application.RecentFiles(1)) doesn't display an empty message box. I'm stumped. Pete doesn't display anything - not even the messagebox "chijanzen" wrote: Peter: Other method,delete ThisWorkbook.FullName in RecentFiles list With ThisWorkbook For Ndx = 1 To Application.RecentFiles.Count If Application.RecentFiles(Ndx).Path = .FullName Then Application.RecentFiles(Ndx).Delete Exit For End If Next Ndx End With -- 天行健,君*以自強不息 地勢坤,君*以厚德載物 http://www.vba.com.tw/plog/ "Peter Rooney" wrote: Good morning, all, One of my applications disables the recently used file list, but when I re-enable it, all its entries are lost. Is there any way in which I can store the filenames in the list to an array, then restore them later on? Thanks in advance Pete |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
ChiJanZen,
I'm quite a bit further on now, thanks to your help! I have now successfully stored the items in the recently used file list to a variable, and I can reference the array elements individually. What I now want to do is first of all display them in a for each loop, then work towards restoring them back from the array to the recently used file list once more. However, I'm having some trouble doing this. Here's what I have: Sub A0_RecentlyUsedFileListStore() ReDim RecentFileListArray(Application.RecentFiles.Count - 1) 'As Variant On Error Resume Next MsgBox (Application.RecentFiles.Count & " file(s) in Recently Used File List") For NDX = 1 To Application.RecentFiles.Count MsgBox (Application.RecentFiles(NDX).Name) RecentFileListArray(NDX) = Application.RecentFiles(NDX).Name Next MsgBox (LBound(RecentFileListArray) & " " & UBound(RecentFileListArray)) End Sub When I run my display macro, I get a "Subscript out of range" error. Sub A0_RecentlyUsedFileListDisplay() Dim Counter As Integer For Counter = LBound(RecentFileListArray) To UBound(RecentFileListArray) MsgBox (RecentFileListArray(Counter)) Next End Sub Any ideas what I'm doing wrong now, please? Thanks in advance Pete "chijanzen" wrote: Peter: doesn't display an empty message box. MsgBox (Application.RecentFiles(1).Path) or Dim Recent As Variant Sub test() ReDim Recent(Application.RecentFiles.Count) For Each f In Application.RecentFiles Recent(I) = f.Path I = I + 1 Next ' Application.RecentFiles.Maximum = 0 For I = 0 To UBound(Recent) MsgBox Recent(I) Next I End Sub -- 天行健,君*以自強不息 地勢坤,君*以厚德載物 http://www.vba.com.tw/plog/ "Peter Rooney" wrote: Good morning, ChiJanZen Well, at least I understand the object collection that I need to refer to, but I can't get it to work at the moment. Even MsgBox (Application.RecentFiles(1)) doesn't display an empty message box. I'm stumped. Pete doesn't display anything - not even the messagebox "chijanzen" wrote: Peter: Other method,delete ThisWorkbook.FullName in RecentFiles list With ThisWorkbook For Ndx = 1 To Application.RecentFiles.Count If Application.RecentFiles(Ndx).Path = .FullName Then Application.RecentFiles(Ndx).Delete Exit For End If Next Ndx End With -- 天行健,君*以自強不息 地勢坤,君*以厚德載物 http://www.vba.com.tw/plog/ "Peter Rooney" wrote: Good morning, all, One of my applications disables the recently used file list, but when I re-enable it, all its entries are lost. Is there any way in which I can store the filenames in the list to an array, then restore them later on? Thanks in advance Pete |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Peter:
try, Dim RecentFileListArray As Variant Option Base 1 Sub A0_RecentlyUsedFileListStore() ReDim RecentFileListArray(Application.RecentFiles.Count) 'As Variant On Error Resume Next MsgBox (Application.RecentFiles.Count & " file(s) in Recently Used File List ") For NDX = 1 To Application.RecentFiles.Count MsgBox (Application.RecentFiles(NDX).Name) RecentFileListArray(NDX) = Application.RecentFiles(NDX).Name Next MsgBox (LBound(RecentFileListArray) & " " & UBound(RecentFileListArray)) End Sub Sub A0_RecentlyUsedFileListDisplay() Dim Counter As Integer For Counter = LBound(RecentFileListArray) To UBound(RecentFileListArray) MsgBox (RecentFileListArray(Counter)) Next End Sub -- 天行健,君*以自強不息 地勢坤,君*以厚德載物 http://www.vba.com.tw/plog/ "Peter Rooney" wrote: ChiJanZen, I'm quite a bit further on now, thanks to your help! I have now successfully stored the items in the recently used file list to a variable, and I can reference the array elements individually. What I now want to do is first of all display them in a for each loop, then work towards restoring them back from the array to the recently used file list once more. However, I'm having some trouble doing this. Here's what I have: Sub A0_RecentlyUsedFileListStore() ReDim RecentFileListArray(Application.RecentFiles.Count - 1) 'As Variant On Error Resume Next MsgBox (Application.RecentFiles.Count & " file(s) in Recently Used File List") For NDX = 1 To Application.RecentFiles.Count MsgBox (Application.RecentFiles(NDX).Name) RecentFileListArray(NDX) = Application.RecentFiles(NDX).Name Next MsgBox (LBound(RecentFileListArray) & " " & UBound(RecentFileListArray)) End Sub When I run my display macro, I get a "Subscript out of range" error. Sub A0_RecentlyUsedFileListDisplay() Dim Counter As Integer For Counter = LBound(RecentFileListArray) To UBound(RecentFileListArray) MsgBox (RecentFileListArray(Counter)) Next End Sub Any ideas what I'm doing wrong now, please? Thanks in advance Pete "chijanzen" wrote: Peter: doesn't display an empty message box. MsgBox (Application.RecentFiles(1).Path) or Dim Recent As Variant Sub test() ReDim Recent(Application.RecentFiles.Count) For Each f In Application.RecentFiles Recent(I) = f.Path I = I + 1 Next ' Application.RecentFiles.Maximum = 0 For I = 0 To UBound(Recent) MsgBox Recent(I) Next I End Sub -- 天行健,君*以自強不息 地勢坤,君*以厚德載物 http://www.vba.com.tw/plog/ "Peter Rooney" wrote: Good morning, ChiJanZen Well, at least I understand the object collection that I need to refer to, but I can't get it to work at the moment. Even MsgBox (Application.RecentFiles(1)) doesn't display an empty message box. I'm stumped. Pete doesn't display anything - not even the messagebox "chijanzen" wrote: Peter: Other method,delete ThisWorkbook.FullName in RecentFiles list With ThisWorkbook For Ndx = 1 To Application.RecentFiles.Count If Application.RecentFiles(Ndx).Path = .FullName Then Application.RecentFiles(Ndx).Delete Exit For End If Next Ndx End With -- 天行健,君*以自強不息 地勢坤,君*以厚德載物 http://www.vba.com.tw/plog/ "Peter Rooney" wrote: Good morning, all, One of my applications disables the recently used file list, but when I re-enable it, all its entries are lost. Is there any way in which I can store the filenames in the list to an array, then restore them later on? Thanks in advance Pete |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Recently used file list | Excel Discussion (Misc queries) | |||
'Recently used file' list. | New Users to Excel | |||
recently used file list | Excel Discussion (Misc queries) | |||
"Recently Used File List" | Excel Discussion (Misc queries) | |||
Most Recently Used File list | Excel Programming |