Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Jul 2002
    Location
    PA, USA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Automated Forms in Word. (2000 SR1a)

    Hi, I have been asked to try to find a solution to the following problem:

    We have a .log file (text, semicolon-delimited, I'm pretty sure) that we get from customer system audits. We then take a lot of the information from that file and put it into a Word document that has some static sections, and some sections that are copy/pasted from the log file (usually after it's been uploaded in Excel, so the data is easier to find and copy/paste).

    What we would like to do is automate this process -- make it so that we can grab sections from the log file (can't grab just cell names from Excel, as the relative positions of information in the cells changes, depending on the customer's system -- they might have 1 hard drive, or 5, for example) and paste them into the proper dynamic section without actually doing the cutting and pasting (we need to process too many per day for this to be a solution).

    I'm open to using other applications outside of Word if that can't fulfill our needs -- I know little about Access, for example, but perhaps the info could be imported into an Access database, and then set up a form with our static parts, and fields for the dynamic parts that can be filled in with info from the database? I wouldn't begin to know how to do that, though....

    Thanks for any help you can provide!

    Sincerely,
    Andrew

  2. #2
    Star Lounger
    Join Date
    Sep 2001
    Posts
    83
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automated Forms in Word. (2000 SR1a)

    Hello Andrew

    The task you are describing is highly suited for a small VBA program. VBA is the program language integrated into MS Office and can therefore interact directly with your word document. I suggest you start looking for a VBA programmer near you (perhaps you do even have one internally?).

    Regards,
    hedgehog

  3. #3
    New Lounger
    Join Date
    Jul 2002
    Location
    PA, USA
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automated Forms in Word. (2000 SR1a)

    Thanks for your response, hedgehog!

    Hmm...not sure if we do or not. I know we have no one official, but we may have a few folks around who know their way around VBA. I'll ask around.

    Any other suggestions?

  4. #4
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Automated Forms in Word. (2000 SR1a)

    You could get the basics of how to do it by planning exactly what it is that you want to do and then recording a macro to achieve the task.

    The basic process would be to have bookmarks as placeholders in the document where the pasting will occur then record a macro and:
    1. Open the log file
    2. Search for the position in the file that marks the start of the first block to be copied. (You may need a couple of arrow key presses here)
    3. Turn on the Extend Selection
    4. Search for the position in the file that marks the end of the first block to be copies. (You may need a couple of arrow key presses here too)
    5. Copy
    6. Activate the first document
    7. GoTo the first bookmark
    8. Paste
    9. Activate the log file (Repeat for as many blocks as you need)
    10. Close the log file
    Stop the macro recording.

    This would give you some very useful code that could then be modified to simplify the process and include prompting the user for which log file to open. The logic is fairly simple and it would be a snap to create. Even as a beginner you will discover that the code is pretty easy to understand. The tricky part is finding the search parameters that will always allow the code to find the right block to to copy. If the pattern is simple then its easy, if not you may need to learn some wildcard searches.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

Posting Permissions

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