Opening a document without having it insereted into *Windows*'s Recent Documents?

S

S. Neumann

Hi!

I have a VB project which automates opening of documents. My problem is
every document I open through the application gets a shortcut in the
recent document.

In short, I don't want any documents opened by the program to get into
"Recent Documents" but I do want that documents not opened by the
program will be inserted into "Recent" as usual - thus, I don't want to
disable "Recent" completely.

Thanks in advance,
S. Neumann
 
V

vlad

I use the next code to open documents. This method does not add any links to
"Recent Documents"

Public Sub OpenLink(DocPath As String)
Dim objShell As Object
Dim ReturnErr As Long
Const SW_SHOWMAXIMIZED = 3 ' other constants can be used too

On Error GoTo err_fix

If DocPath = "" Then
Exit Sub
End If

Set objShell = CreateObject("WScript.Shell")
ReturnErr = objShell.Run("""" + DocPath + """", SW_SHOWMAXIMIZED)
Set objShell = Nothing

Exit Sub
err_fix:
If Err.Number = -2147024894 Then
MsgBox "File does not exist"
Else
Debug.Print Err.Number & " - " & Err.Description
End If
End Sub


"S. Neumann"
 
Top