Solved

AddToRecentFiles:=False not working in Word VBA macro

Posted on 2013-11-25
3
1,009 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 48

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Always hangs on opening 8 53
copying from excel to word 2 36
Vlookup for IP 3 50
Office 365 vs. In-House 4 30
Shortcuts in Word Just the other day I had a training for Microsoft and they wanted me to show how well the new Windows and Office behaved on a touch device, which by the way is great, but it was only then that I realized that using keyboard shortc…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

705 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now