yinkajewole
Active Member
- Joined
- Nov 23, 2018
- Messages
- 281
using a listbox, how do i let it display up to 60 recently opened files.
Private Sub ListBox1_GotFocus()
Application.RecentFiles.Maximum = [COLOR=#ff0000]50[/COLOR]
ListBox1.Clear
Dim i As Integer
For i = 1 To [COLOR=#ff0000]50[/COLOR]
On Error GoTo TheEnd
ListBox1.AddItem Application.RecentFiles(i).Path
Next
TheEnd:
End Sub
ListBox1.AddItem Application.RecentFiles(i).Name
My version of Excel errors if maximum is set above 50
Test unaltered first and then try amending to 60
Code:Private Sub ListBox1_GotFocus() Application.RecentFiles.Maximum = [COLOR=#ff0000]50[/COLOR] ListBox1.Clear Dim i As Integer For i = 1 To [COLOR=#ff0000]50[/COLOR] On Error GoTo TheEnd ListBox1.AddItem Application.RecentFiles(i).Path Next TheEnd: End Sub
For the Name without path
Code:ListBox1.AddItem Application.RecentFiles(i).Name
My version of Excel errors if maximum is set above 50
Test unaltered first and then try amending to 60
Code:Private Sub ListBox1_GotFocus() Application.RecentFiles.Maximum = [COLOR=#ff0000]50[/COLOR] ListBox1.Clear Dim i As Integer For i = 1 To [COLOR=#ff0000]50[/COLOR] On Error GoTo TheEnd ListBox1.AddItem Application.RecentFiles(i).Path Next TheEnd: End Sub
For the Name without path
Code:ListBox1.AddItem Application.RecentFiles(i).Name
@My Aswer Is This confirmed that the solution posted works wellusing a listbox, how do i let it display up to 60 recently opened files
Q2 Why would this be helpful? Are you wanting a longer list than Excel maintains?what about this idea, that the recently opened files should be saved into a textfile, and the files should be retrieved from the text file. is it possible?