?
Solved

AddToRecentFiles:=False not working in Word VBA macro

Posted on 2013-11-25
3
Medium Priority
?
1,083 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:Bryce Bassett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 52

Accepted Solution

by:
Rgonzo1971 earned 1000 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:Bryce Bassett
ID: 39676859
That did the trick, Thanks!
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

764 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