ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Recent File List (https://www.excelbanter.com/excel-programming/435844-recent-file-list.html)

Hal

Recent File List
 
Hello all,

I want to have a workbook check if its name is in the recent file list.

Please advise on how to use the RecentFile(s) classes to do this.

Private Sub Workbook_Open()
If workbookname is in recent file list Then
MsgBox ("Display Me!")
End If
End Sub

Thanks.

Mike H

Recent File List
 
Hi,

Something like this

myworkbook = "Book1.xlsx"
With ThisWorkbook
For i = 1 To Application.RecentFiles.Count
If Application.RecentFiles(i).Name = myworkbook Then
'do something
End If
Next i
End With

Mike

"Hal" wrote:

Hello all,

I want to have a workbook check if its name is in the recent file list.

Please advise on how to use the RecentFile(s) classes to do this.

Private Sub Workbook_Open()
If workbookname is in recent file list Then
MsgBox ("Display Me!")
End If
End Sub

Thanks.


Hal

Recent File List
 
Thanks Mike,

I'll give this a try. After I posted I started to wonder if this was even
possible. Depending on when a document name gets added to the recent file
list.



"Mike H" wrote:

Hi,

Something like this

myworkbook = "Book1.xlsx"
With ThisWorkbook
For i = 1 To Application.RecentFiles.Count
If Application.RecentFiles(i).Name = myworkbook Then
'do something
End If
Next i
End With

Mike

"Hal" wrote:

Hello all,

I want to have a workbook check if its name is in the recent file list.

Please advise on how to use the RecentFile(s) classes to do this.

Private Sub Workbook_Open()
If workbookname is in recent file list Then
MsgBox ("Display Me!")
End If
End Sub

Thanks.


Chip Pearson

Recent File List
 
Try something like

Private Sub Workbook_Open()
Dim S As String
Dim N As Long
With Application.RecentFiles
For N = 1 To .Count
If StrComp(Me.Name, .Item(N).Name, vbTextCompare) = 0 Then
MsgBox "In List"
Exit For
End If
Next N
End With
End Sub


Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Thu, 5 Nov 2009 06:45:03 -0800, Hal
wrote:

Hello all,

I want to have a workbook check if its name is in the recent file list.

Please advise on how to use the RecentFile(s) classes to do this.

Private Sub Workbook_Open()
If workbookname is in recent file list Then
MsgBox ("Display Me!")
End If
End Sub

Thanks.



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com