Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 325
Default Restoring the Recently Used File List

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 139
Default Restoring the Recently Used File List

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 325
Default Restoring the Recently Used File List

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 139
Default Restoring the Recently Used File List

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 325
Default Restoring the Recently Used File List

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 139
Default Restoring the Recently Used File List

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Recently used file list tgi Excel Discussion (Misc queries) 2 October 1st 09 02:38 PM
'Recently used file' list. DB. New Users to Excel 3 November 20th 06 07:22 PM
recently used file list Shari Excel Discussion (Misc queries) 11 October 19th 06 08:52 PM
"Recently Used File List" phil6666 Excel Discussion (Misc queries) 13 April 20th 05 03:58 PM
Most Recently Used File list altira Excel Programming 1 February 29th 04 12:33 PM


All times are GMT +1. The time now is 10:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright 2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"