Jay
Wed Nov 05 21:45:19 CST 2003
Hi, Ed,
Since no one else has replied to your post, I'll take a stab at it.
The sort of thing you propose is certainly possible, but there are a few
more bits of information you need to supply to make a reasonable start on
the macro.
- Are the names of the report and the table document well known in advance,
or do they change from one run to the next?
- Are you sure there is one paragraph in the report for each table, and one
table for each paragraph? Or could there be some "not found", or some
two-to-one correspondences?
- When you say the code group is "mentioned" in a paragraph, is it the only
thing in the paragraph, or is it surrounded by other text? How do you
recognize that a particular piece of text is, or contains, a code group?
Could there be a third document containing a list of all possible code
groups?
- Do all the tables have the same number of columns, so you know the code
groups are in column x, or is the column count variable?
- Do you have separate templates (not Normal.dot) dedicated to creating
reports and table documents?
- Do you already have a macro to chop up the big table into smaller ones, or
does the report macro need to do that as well?
Just off the top of my head, I think the programming will go easier if the
macro looks at the code group in a table, searches the report document for
that code group, and copies the table as the next paragraph; then goes to
the next table, etc. Can you see any objection to that method?
There are probably some other questions that ought to be asked, but that'll
do for a start.
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ:
http://www.mvps.org/word
Ed wrote:
> I hope I can word this intelligently. I get a range from an Excel
> spreadsheet and paste it as a table into Word. The Word table is then
> broken into several smaller tables, based on a code group in the last
> column - this is saved as its own document. Could be anywhere from
> 20-40 smaller tables, each of which needs to go in its corresponding
> place in a report. There are actually about a hundred possible code
> groups.
>
> Is there any way I can write some code for the report that will:
> (A) find the code group mentioned in the paragraph preceeding the
> table's place,
> (B) open the document with the tables, find the right one, and paste
> it in, and
> (C) automatically update the report upon opening with the latest saved
> tables?
>
> Ed