Results 1 to 2 of 2
2013-06-02, 04:39 #1
- Join Date
- Jun 2013
- Thanked 0 Times in 0 Posts
Macro for watermarking multiple docs with filename
I need a macro to loop through a folder of Word documents and, with each document, add a watermark consisting of the filename and then save the file. I know how to loop through the documents but not how to put the filename in a watermark. I have seen solutions that use the Building Blocks functionality to add a watermark – but only with fixed text, not with the current filename. Can anyone help?
2013-06-02, 11:52 #2
- Join Date
- Feb 2001
- Willow Grove, Pennsylvania, USA
- Thanked 49 Times in 40 Posts
In a blank document, use the macro recorder to record the steps of clicking Page Layout > Watermark > Custom Watermark > Text Watermark > OK.
Turn off the recorder and open the macro editor, and go to the macro you recorded. This will be the usual sloppy mess. The third and fourth statements should look something like this, probably with just a different number after "PowerPlusWaterMarkObject". (I can just picture the dweeb who first wrote that name. )
Selection.HeaderFooter.Shapes.AddTextEffect( _ PowerPlusWaterMarkObject99714653, "ASAP", "Calibri", 1, False, False, 0, _ 0).Select Selection.ShapeRange.Name = "PowerPlusWaterMarkObject99714653"
Selection.HeaderFooter.Shapes.AddTextEffect(msoTextEffect1, _ ActiveDocument.FullName, "Calibri", 1, False, False, 0, 0).Select Selection.ShapeRange.Name = "FilenameWatermark"
Call this macro from the code that opens each document in the folder.
Last edited by jjfreedman; 2013-06-02 at 11:55. Reason: Add sentence about .Name