PDA

View Full Version : Solved: Creating Tables when key words are found



lawtai
08-15-2005, 02:15 PM
I'm new to the whole macro scene and was wondering if anyone could offer some help. I was wondering if this is at all possible, and if so, if someone could point me in the right direction to get started on creating this macro.

I would like to be able to take an already created word document which is as follows:

Title

1. Text goes here. Record (Short Description A)
2. Normal Text
3. More text here. Record (Short Description B)

I want to be able to have the macro locate the places where I use "Record" and take those lines and add them to a table in a new Word doc, to create a sort of checklist. I'd want to populate the table with the line #, the (short description) and then also have 3 extra blank cells for pass/fail/comments respectively.

The resulting table would look something like this:

Title

Step # | Description | Pass | Fail | Comment
-------------------------------------------
1 | Short Description A | | |
--------------------------------------------
3 | Short Description B | | |

My original document would include several pages of these lists, with the list sometimes running a few pages and each new list having a title.

Is something like this possible? How can I get started on it? Thanks for any help that you can offer!

lawtai
08-16-2005, 06:56 AM
anyone?

fumei
08-16-2005, 07:14 AM
This is very possible, and not all that difficult. It would take proper design elements. It would take a proper, full, step by step analysis and precisely what you want to happen.

For example....you mention line number. What exactly do you mean by that? And why, exactly, is this significant? Do you really need it? Line numbers are slippery things.

Another example. Are you using styles? Are you using bookmarks? Or are you trying to search for text. In other words, is the document DESIGNED to retrieve chunks the way you want? By that I mean, ....OK, let's look at your example.

Title

1. Text goes here. Record (Short Description A)
2. Normal Text
3. More text here. Record (Short Description B)

"Text goes here" - what does that mean? Does the user type in text at this location? if so, does the user manually move the cursor to that location to typer? If you used formfields, the cursor could be made to GO THERE.

What does "normal text" mean? What makes it different from the other text?

Title

Step # | Description | Pass | Fail | Comment
-------------------------------------------
1 | Short Description A | | |
--------------------------------------------
3 | Short Description B | | |

Where is the Step # picked up....what is this number? How is it identified?

Why are the items in the table 1...then 3. What are those numbers?

What I am getting at, is......ABSOLUTELY, this is possible. Totally possible. If you post both a sample source doc - one with the lists, and a sample data doc - one with how you would like to work out, I am sure we can help you find a solution.

Killian
08-16-2005, 07:23 AM
hmmm... yes, an lot is going to depend on how the original document is structured. If each record is in it's own paragraph and the description runs from the end of the word "Record" to the end of that paragraph, it's very simple - if it's down to counting line numbers etc. then there'll be some working out to do.
As Gerry says, an example would get us going along the right track...

lawtai
08-16-2005, 08:15 AM
I've posted a simple example of my doc ( http://www.taibros.net/temp/example.doc ) file.

To answer some of your questions:

I want to take my test plan which resembles my example file, and create a test log checklist file. The checklist file will take title, steps and descriptions of the tests from the test plan and bring them into the test log.

I want the step #'s so that I can have a way to reference which part of the test they're running. Since step 3 tells the reader to record results, I want to put the description I have (which will always be in parentheses), the step # it's located (I'm using word's auto numbering system) and put them into the table to create a simple checklist of the steps where the reader needs to record data. The reader does nothing with the test plan file other than to read and follow the steps given. They only record onto the test log file. (This will be printed out and done with pencil/paper)

I'm not currently using bookmarks, but I could set that up although I'd have probably 50 of these test plans so the bookmarks would get quite lengthy in number. There will always be the words "Record results" on the line that I want moved over to the test log file.

I hope this helps in answering your questions. Thanks again for your help. Some guidance into how I can start this (what code to write) would be helpful since I'm really new at this stuff.