Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AddToRecentFiles not functioning

Status
Not open for further replies.

duGly

Technical User
Nov 13, 2006
52
US
I am using VBA with Word 2003. I have a procedure which creates new documents, then opens them for programmatic editing. It then saves and closes the document.

Even though I have the AddToRecentFiles property set to false, the new documents still get added to my recent files list. Has anyone encountered this problem before and found a workaround?

Code:
    Set m_Doc = Documents.Open(FileName:=m_strFileLocation & strDocumentName, _
        AddToRecentFiles:=False, Visible:=False)

[purple][ponder]— Artificial intelligence is no match for natural stupidity.[/purple]
 
In fact the new documents are not added to the File menu list.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Actually, that's exactly where they are getting added: the File menu list of recently opened documents. This is what I'd like to avoid.

[purple][ponder]— Artificial intelligence is no match for natural stupidity.[/purple]
 
I have a procedure which creates new documents
How are the documents created ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Here's my code:
Code:
    ' Copy and rename document.
    m_fsObject.CopyFile m_strSource & strSourceFile, m_strFileLocation
    m_fsObject.GetFile(m_strFileLocation & strSourceFile).Name = strDocumentName

    ' Set m_Doc to newly created document and open it.
    Set m_Doc = Documents.Open(FileName:=m_strFileLocation & strDocumentName, _
        AddToRecentFiles:=False, Visible:=False)

[purple][ponder]— Artificial intelligence is no match for natural stupidity.[/purple]
 
When you open the document with AddToRecentFiles:=False, it is not added to the MRU list. This happens when you save it. Use SaveAs with AddToRecentFiles:=False.

combo
 
Cool! Thank you so much!

[red][banghead]— Artificial intelligence is no match for natural stupidity.[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top