?
Solved

AddToRecentFiles:=False not working in Word VBA macro

Posted on 2013-11-25
3
Medium Priority
?
1,128 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
2 Comments
 
LVL 54

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Microsoft's Excel has many features that most people will never need nor take advantage of.  Conditional formatting is one feature that you may find a necessity once you start using it.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

757 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