Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Hal Hal is offline
external usenet poster
 
Posts: 36
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
Hal Hal is offline
external usenet poster
 
Posts: 36
Default 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.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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.

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
How to delete Excel 2007 file from list under Recent Documents GPS Excel Discussion (Misc queries) 5 May 9th 23 11:47 AM
Recent File List Empty MrsBear87 Excel Discussion (Misc queries) 0 April 24th 09 02:18 PM
Recent File List Check Box Greyed out Bruce Wilson Excel Discussion (Misc queries) 7 February 22nd 07 03:15 PM
Recent File List Problem GB Excel Programming 1 January 12th 06 09:25 PM
Most recent file list Mikerosoft Excel Programming 1 December 21st 05 03:19 PM


All times are GMT +1. The time now is 01:58 AM.

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"