Yeah, OK... There are people here who have solutions. I'm one...
The hassle we're having is that *learning* to do this stuff in code is quite
a project; we would not really suggest that unless you are already a
competent coder (no, you won't learn it in a couple of WEEKS). On the other
hand, doing it *for* you goes beyond the bounds of what we would do for
someone for "free" (unless you're very good looking ...)
First, let's simplify the problem. I assume that "LotTitle" is the only
style you are interested in, and that there is intervening text in the
document between the title paragraphs. So you want the content of each
paragraph formatted in LotTitle in a spreadsheet?
OK, so create a document and insert a table of contents that has as its
entry only one style: LotTitle. Look up "Field codes: TOC (Table of
Contents) field" in the Help. You need a TOC field like this:
{ TOC \o "LotTitle,1" \n }
The \n switch takes the page numbers off for you, because you don't want
them, you just want a "list".
Now, call in all of your other documents with RD fields. Look up "Field
codes: RD (Referenced Document) field" in the Help:
{ RD " INCat.doc" }{ RD " INCat.2doc" }{ RD " INCat3.doc" }{ RD "
INCat4.doc" }
The other source documents must all be saved and in the same folder as your
master file. If they're not, you need to specify the full path name in each
of those RD fields.
Generate your Table of contents. Copy just the TOC and paste it into a new
document. Unlink the field (see " Prevent changes to information inserted
by a field"). You should have just a list of the paragraphs formatted with
LotTitle style and no page numbers.
Save this as a plain text file. Use the Excel Text Import Wizard to bring
it into a spreadsheet as "delimited" text (see "Use a text file as a data
source" in the Excel help. Specify a hyphen as the delimiter.
Every now and again, you will find a hyphen in the title which will split
the title over two columns. I would simply eye-ball to find those and merge
the cells where it happens.
I think that's done the grunt work for you, without a macro.
Your problem is that you are using the same delimiter to have two different
meanings.
If you hit the users hard enough to persuade them to use real tabs when they
mean a delimiter, or to use an em-dash when they mean a hyphen, then you
won't have to fiddle around. However, if you have a LOT of them, then
you'll have to sort it out in Excel.
(You should be able to do this in Word, but unfortunately Mac Word has a bug
in it that hangs it if you attempt a replace in a vertical column
selection!)
The column to the right of the Title column should be blank. If there's a
hyphen in the title, Excel will place the remainder of the title in the
column to the right of the title.
Make a formula in Excel that concatenates the two if that happens. For
example, let's assume you have the Title in column D. If there's a hyphen
in the title, that title will spill to column E. Insert a column to the
left of D, and paste in a formula such as =IF(F1<>"",E1 & " " & F1,E1)
Fill down, and Excel will concatenate the cell content from the cells that
have tabbed across for you.
Of course, you could extend the formula to allow for the presence of more
than one hyphen in the title. Or hit users who typed that twice as hard...
There we go, job done without a line of code
Cheers
Anybody have any solutions for the four issues? Or can direct me to
where I can learn to fix it myself? Especially part 1. I've got over a
hundred of these to pull out from one document and that takes a long
time.
1. I have to execute this over and over again to pull each line. It
would be great to have it just keep going until it had exhausted every
occurrence of the "LotTitle" style.
2. After I've pasted the text into the new file I select the first part
of the text and do a find/replace hypen to tab. After it does the find
replace it pops up a dialog "Word has finished search the selection. 2
replacements were made. Do you want to search the remainder of the
document?" I had recorded me saying "No", but it didn't record. I don't
want to have to answer this for each entry. How do I make it go away.
3. What if the secondary document isn't called "Document2"
4. What if the original document isn't called "INCat.doc" Okay, okay, 3
and 4 are really the same thing!
--
Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.
John McGhie <
[email protected]>
Microsoft MVP, Word and Word for Macintosh. Consultant Technical Writer
Sydney, Australia +61 (0) 4 1209 1410