SHAddToRecentDocs problem

S

Saune

I used
SHAddToRecentDocs(2, installpath & myfile) to add myfile to Recent documents.

Then I used the following loop to Wait for the SHAddToRecentDocs to add
shortcut
Do While Dir(RecentPath & myfile & ".lnk") = ""
Loop

The problem is that it never gets out of the loop.

Could anybody help me to point out why ?
I checked the Recent path to be correct and also checked that the 'myfile'
is in the Recent folder.
 
D

Douglas J Steele

Try the following:

Dim strFile As String

strFile = Dir(RecentPath & myfile & ".lnk")
Do While Len(strFile) > 0
....
strFile = Dir()
Loop

The problem with your code, I believe, is that it's always requiring the
directory, so you're always getting the first file.
 
D

Douglas J Steele

Darn dyslexic fingers! That should be "it's always requerying the
directory"!
 
Top