Solved

AddToRecentFiles:=False not working in Word VBA macro

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Word - Access 3 48
MS Office 2013 for purchase 3 56
recent docs in word and excel 3 38
How to attach a folder from the desktop to an outgoing e-mail using Hotmail? 8 25
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…
My experience with Windows 10 over a one year period and suggestions for smooth operation
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

914 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

21 Experts available now in Live!

Get 1:1 Help Now