+ Reply to Thread
Results 1 to 11 of 11

How to automate a monotonous & time-consuming process in Word by way of creating a macro??

  1. #1
    Registered User
    Join Date
    01-02-2012
    Location
    Melbourne
    MS-Off Ver
    Excel 2003
    Posts
    51

    How to automate a monotonous & time-consuming process in Word by way of creating a macro??

    Hello everyone

    I have a large group of word documents that contain a "Header & Footer" that I'd like to delete from each word file. Doing it to all documents individually would take quite some time.

    Is there a macro that can be written so that this is achieved as efficiently and timely as possible?

    I've attached 2 sample word documents, each has 2 versions. One version (the "BEFORE") contains the header and footer, the other version (the "AFTER") is what I want the document to ultimately look like.

    If there's anyone who can help me out that would be awesome

    Thanks in advance

    Rob
    Attached Files Attached Files

  2. #2
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: How to automate a monotonous & time-consuming process in Word by way of creating a mac

    Try this macro out see if it works for you

    copy to clipboard
    Please Login or Register  to view this content.
    If you liked my solution, please click on the Star -- to add to my reputation

    If your issue as been resolved, please clearly state so and mark the thread as [SOLVED] using the thread tools just above the first post.

  3. #3
    Registered User
    Join Date
    01-02-2012
    Location
    Melbourne
    MS-Off Ver
    Excel 2003
    Posts
    51

    Re: How to automate a monotonous & time-consuming process in Word by way of creating a mac

    Thanks DGagnon,

    i tried it and this was the error message that came up (screen shot attached)

    let me know if there is something im doing wrong'

    Cheers
    Rob
    Attached Images Attached Images

  4. #4
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: How to automate a monotonous & time-consuming process in Word by way of creating a mac

    you need to run it from Word, not Excel, you can open a word document and enter the VBE by pressing Alt+F11

  5. #5
    Registered User
    Join Date
    01-02-2012
    Location
    Melbourne
    MS-Off Ver
    Excel 2003
    Posts
    51

    Re: How to automate a monotonous & time-consuming process in Word by way of creating a mac

    Thanks dgagnon

    Worked like a treat!

    The only ones the code didnt pick up were documents with a first page with no header and footer.

    I have attached 3 files (each with a slightly different format)

    Sample 1.doc - the code worked perfectly on this type (85% of files look like this)
    Sample 2.doc - the code didnt work (10% of files ...)
    Sample 3.doc - the code didnt work (5% of files ...)

    Any way to overcome this?
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    1,157

    Re: How to automate a monotonous & time-consuming process in Word by way of creating a mac

    Try:
    copy to clipboard
    Please Login or Register  to view this content.
    Cheers,
    Paul Edstein
    [MS MVP - Word]

  7. #7
    Registered User
    Join Date
    01-02-2012
    Location
    Melbourne
    MS-Off Ver
    Excel 2003
    Posts
    51

    Re: How to automate a monotonous & time-consuming process in Word by way of creating a mac

    thanks alot Paul, worked perfectly

  8. #8
    Registered User
    Join Date
    01-02-2012
    Location
    Melbourne
    MS-Off Ver
    Excel 2003
    Posts
    51

    Re: How to automate a monotonous & time-consuming process in Word by way of creating a mac

    One final question for now.

    Is it possible to "find and replace" words in file names?

    for example, this is what I currently have:

    gary white - TI Version.doc
    joe blogs - AB Version.doc
    joe smith - XT Version.doc
    sally brown - RB Version.doc

    this is what I would like to have:

    gary white - WW.doc
    joe blogs - XX.doc
    joe smith - YY.doc
    sally brown - ZZ.doc

    in summary:

    all file names that contain "TI" change to WW
    " " "AB" change to XX
    " " "XT" change to YY
    " " "RB" change to ZZ

    And the word "version" gets erased

    this would be awesome if it were possible

  9. #9
    Valued Forum Contributor
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    1,157

    Re: How to automate a monotonous & time-consuming process in Word by way of creating a mac

    You will have to rename the documents. That is not something Find/Replace can do.

  10. #10
    Registered User
    Join Date
    01-02-2012
    Location
    Melbourne
    MS-Off Ver
    Excel 2003
    Posts
    51

    Re: How to automate a monotonous & time-consuming process in Word by way of creating a mac

    thanks Paul, much appreciated
    Last edited by Rob8489; 05-06-2012 at 01:56 AM. Reason: solved issue

  11. #11
    Forum Guru martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    18,939

    Re: How to automate a monotonous & time-consuming process in Word by way of creating a mac

    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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