Solved

AddToRecentFiles:=False not working in Word VBA macro

Posted on 2013-11-25
3
1,027 Views
Last Modified: 2013-11-28
I've got a Word (2010) macro written in VBA that changes the footers in a whole folder of different documents, by opening them one at a time, making the changes, and re-saving them.  I'm trying to prevent all those documents opened by the macro from appearing in my File/Recent list, but they do.  Here's the relevant snippet of code:

file2open = projectfolder & ExistingDoc(E, 0, 0) & "\" & ExistingDoc(E, counter, 0)
Set changedoc = Application.Documents.Open(FileName:=file2open, AddToRecentFiles:=False)
' change footer
changedoc.Close wdSaveChanges

Open in new window

Any idea why this isn't working?
0
Comment
Question by:versatilebb
3 Comments
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 250 total points
ID: 39676821
Hi,

pls try

file2open = projectfolder & ExistingDoc(E, 0, 0) & "\" & ExistingDoc(E, counter, 0)
Set changedoc = Application.Documents.Open(FileName:=file2open, AddToRecentFiles:=False)
' change footer
changedoc.SaveAs FileName:=file2open, AddToRecentFiles:=False
changedoc.Close wdDoNotSaveChanges

Open in new window

Regards
0
 

Author Closing Comment

by:versatilebb
ID: 39676859
That did the trick, Thanks!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question