+ Reply to Thread
Results 1 to 4 of 4

Simple Looping Example needed

  1. #1
    Registered User
    Join Date
    02-24-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    32

    Simple Looping Example needed

    I'd like to loop through all .docm files in a directory (call it C:\Work for example), open the document, and perform some action on each file in the directory.

    What code can accomplish this? I know it is simple as can be in excel but I have had trouble finding analogous word examples.

    The action I want to perform is irrelevant but I included it in code tags below.

    Please Login or Register  to view this content.
    Thanks in advance,

    -Michael

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,164

    Re: Simple Looping Example needed

    Hi,
    Office VBA in Word is very close to Excel.

    See if http://www.ozgrid.com/VBA/loop-through.htm can't be modified to do what you need.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Simple Looping Example needed

    You won't be able to use FileSearch, it no longer works with Office 2007 on.

    This will be adaptable for your needs. It's written for Excel, but should work in Word

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Registered User
    Join Date
    02-24-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    32

    Re: Simple Looping Example needed

    Thanks. I will look into modifying the code above.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1