Results 1 to 7 of 7
  1. #1
    New Lounger
    Join Date
    Aug 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Bulk Footer Update Word 2003 (Word 2003)

    Good morning!

    I have around 750 word documents which need their footers updated with a new line of text. Each of the Word documents already has a line of text in the footer but I want to be able to update all 750 automatically by inserting a new line into the footers that already exist. Has anyone ever attempted this or have any ideas on how to do something like this?

    Creon

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Bulk Footer Update Word 2003 (Word 2003)

    If you gather all documents into a single folder, you can run a macro to update the footers. The following assumes that the documents have only one section (or if there are multiple sections, that the footers are linked together), and that you don't have separate footers for the first page or for odd and even pages.

    Sub UpdateFooter()
    ' Modify as needed, but keep trailing backslash
    Const strPath = "C:Test"
    Dim strFile As String
    Dim doc As Document
    Application.ScreenUpdating = False
    strFile = Dir(strPath & "*.doc")
    Do While Not strFile = ""
    Set doc = Documents.Open(strPath & strFile)
    With doc.Sections(1).Footers(wdHeaderFooterPrimary).Ran ge
    .InsertParagraphAfter
    ' Substitute the appropriate text.
    .InsertAfter "Another line"
    End With
    doc.Close SaveChanges:=True
    strFile = Dir
    Loop
    Application.ScreenUpdating = True
    End Sub

    Adapt the code as needed.

  3. #3
    New Lounger
    Join Date
    Aug 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bulk Footer Update Word 2003 (Word 2003)

    Hans,

    Thanks for the code! Do I add the macro to a random Word document that is in the specified folder or do I add it to one of the documents I need to update?

    Dave

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Bulk Footer Update Word 2003 (Word 2003)

    If it's a one-off, I'd put the code in a module in a new (unsaved) document, run it and discard it.
    If you may need to do this more often, put the code in a document in another folder, or in your Normal.dot. Don't put the code in a document in the folder to be processed.

    Oh, and please be aware that the code I posted will process ALL documents in the specified folder. So there should be no other documents in the folder, only the ones to be updated.

  5. #5
    New Lounger
    Join Date
    Aug 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bulk Footer Update Word 2003 (Word 2003)

    Sounds great Hans. I just performed a test on about 5 documents and it worked beautifully. Thanks for the advice!

    Dave

  6. #6
    New Lounger
    Join Date
    Aug 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Bulk Footer Update Word 2003 (Word 2003)

    Hans, what if I had excel files added into the word documents in the folder? Would there have to be an extra line for the excel files in the code?

    Dave

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Bulk Footer Update Word 2003 (Word 2003)

    I wouldn't process Word and Excel files in one macro. You could create a macro to be run from Excel to process workbooks. If you need help with that, please post a separate question in the Excel forum, for the code needed is slightly different (each worksheet in a workbook has its own headers and footers).

Posting Permissions

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