Solved

Mutilple word document changes

Posted on 2011-09-28
4
196 Views
Last Modified: 2012-05-12
hi everyone,
does anyone know of a way to change a footer within hundreds of word documents. I need to apply a address change to hundreds of word documents. I was hoping not to open each one at a time to do this.
Does this make sense?
the original documents were created with a set letterhead.

cheers
0
Comment
Question by:RodneyFirmer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 36715660
You will have to Open them, but not manually.

You could put them in single folder, and run a macro like this
Sub EditDocs()
    Dim strFolder As String
    Dim strFile As String
    Dim doc As Document
    Dim sec As Section
    Dim ftr As HeaderFooter
    
    strFolder = "C:\MyFolder"
    strFile = Dir$(strFolder & "\*.doc*")
    Do Until strFile = ""
        Set doc = Documents.Open(strFolder & "\" & strFile)
        For Each sec In doc.Sections
            For Each ftr In sec.Footers
                ftr.Range.Text = "My New Company"
            Next ftr
        Next sec
        doc.Close wdSaveChanges
        strFile = Dir
    Loop
End Sub

Open in new window

0
 

Author Comment

by:RodneyFirmer
ID: 36914115
Thanks i haven't time to try this, the problem is also many documents within multiple folder structures.

Is there anyway of preventing this problem in the future.
cheers
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 250 total points
ID: 36915385
It would be quicker than doing each one manually,

If you expect to find some time in the near future, it might be worth us modifying the code to recurse down the folder structure, but of course there would need to be some test to see if the document is relevant, e.g. by doing a Find and Replace instead of just setting the text.

Future avoidance would depend on the way that the document files are used. If you are just want to distribute printouts, you could have the text somewhere external to the document, but accessible to you; for instance as an Autotext entry in a the document's template and displayed in an Autotext field.
0
 

Author Closing Comment

by:RodneyFirmer
ID: 36946162
Thnaks for all your help. ended up finding software to do this.

cheers
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I'm writing to share my clumsy experience in using this elegant tool so you can avoid every stupid mistake I made. (I leave it to the authorities to decide if this deserves a place in the Knowledge archives.)  Now that I am on the other side of my l…
This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

707 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