Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Apr 2003
    Location
    Salt Lake City, Utah, USA
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need to open all files in a directory (Word 2003)

    I have really, truly been trying to figure this out on my own, and have collected all sorts of interesting code on how to do different parts of what I need, but when I try to hobble it all together .... nada. I bought the book Word Hacks (which is GREAT, btw) and it has a lovely bit of code for doing some of what I need, but I can't seem to adapt it to do this one particular job.

    Here's what I need to do:

    First, I'll open a Word file containing a log (table format).
    I need to verify that I am working in the right directory (the name changes every time).
    Then I want to open the first Word file in that directory.
    I want to get a word count, then switch to the open log and paste it into the cell the cursor is in, then move the cursor to the next cell.
    Then I want to go back to the open document and get the file name, switch to the log, paste it in the cell.
    Then I need to close the open file (NOT the log), move the cursor to the next row, open the next file in the directory, and do it all over again.

    Anyone got a slick way of doing that?

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

    Re: Need to open all files in a directory (Word 2003)

    Try the code in the attached text file. It assumes that a document with a two-column table is open, and that the insertion point is in a cell in the first column. (You could add code to check this)
    Attached Files Attached Files

  3. #3
    Lounger
    Join Date
    Apr 2003
    Location
    Salt Lake City, Utah, USA
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Need to open all files in a directory (Word 20

    Wow. That is amazing. And itthe code is a lot shorter than I expected it would be. You are just awesome! THANKS!

Posting Permissions

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