Results 1 to 2 of 2
  1. #1
    New Lounger
    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?

  2. #2
    3 Star Lounger
    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, _
        Selection.ShapeRange.Name = "PowerPlusWaterMarkObject99714653"
    Replace those lines with these.

        Selection.HeaderFooter.Shapes.AddTextEffect(msoTextEffect1, _
            ActiveDocument.FullName, "Calibri", 1, False, False, 0, 0).Select
        Selection.ShapeRange.Name = "FilenameWatermark"
    If you don't need the path, use .Name instead of .FullName. If you like, you can put in a different font name in place of Calibri.

    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

  3. The Following 2 Users Say Thank You to jjfreedman For This Useful Post:

    Charles Kenyon (2013-06-02),SophieN (2013-06-04)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts