CodeItBetter Programming Another VB Programming Blog

How to add a given file to Windows Recent Documents List

Posted on August 20, 2009

Here is a procedure to add a given file to Windows Recent Documents List.

1
2
3
4
5
6
7
8
9
10
11
12
13
Option Explicit
 
'API Declarations
Public Declare Sub SHAddToRecentDocs Lib "shell32.dll" (ByVal uFlags As Long, ByVal pv As String)
'Constants Declaration
Const lFlags as long = &H2&
 
Public Sub AddFileToRecentDocumentsList(ByVal sFilePath as String)
  'Add a given file to docs list
  If Not trim$(sFilePath)="" Then 
    SHAddToRecentDocs lFlags, sFilePath
  End IF
End Sub

How can I use this Procedure:

'To Add a file to the Recent Documents list:
call AddFileToRecentDocumentsList ("C:\Temp\TestFile.txt")
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

Trackbacks are disabled.