Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 04-30-2019, 09:01 PM
gmayor's Avatar
gmayor gmayor is offline Mail Merge with Merged File Name in Footer Windows 10 Mail Merge with Merged File Name in Footer Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

While my friend Greg Maxey and I have similar initials, we are not the same person and it is he who is 'Greg'.

The macro Doug supplied is not compatible with the add-in process as even if it was, the macro runs before the document filename is created and thus before it is saved so it cannot reflect the name of that document in its footer.

If the aim is to add the filename to the footer then you can get the name of the document (not the PDF file) with

Code:
Sub FooterTx(oDoc As Document)
Dim i As Long
Dim fname As Range
    With oDoc
        Set fname = .Sections(1).Footers(wdHeaderFooterPrimary).Range
        fname.End = fname.End - 1
        fname.Collapse 0
        fname.Fields.Add fname, wdFieldFileName, " \p", False
    End With
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
showing mail merge all in one file lezawang Mail Merge 3 05-24-2018 03:10 PM
Mail Merge with Merged File Name in Footer Log file for mail merge neilclelland Mail Merge 7 12-08-2016 03:08 PM
some records disappear after emailing mail merged file Dr Ennui Mail Merge 1 06-10-2015 04:17 PM
Mail Merge with Merged File Name in Footer Mail Merge is Deleting objects in my header and footer during the merge bgranzow Mail Merge 9 06-05-2015 05:03 AM
Mail Merge with Merged File Name in Footer how do i ad a specific pdf file to a mail merge? mseibel Mail Merge 1 08-28-2012 07:53 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:45 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft