PDA

View Full Version : Solved: Word and end of page



DeadKing
10-21-2011, 04:36 AM
Hello guys.

I'm tring to write a piece of code of Word macro, which should help me formating tons of text (let's say 400 pages each time) generated by another program.
This text is to be printed and archived and I want it to be easy to read by formating the look of important informations. Right now I'm stuck with this problem:
Part of the text contains some numeric data (the length differs) as an end of its report. I want these datas to be shown on new page, but only in case the data were splited into two pages.
I'm able to detect begin and end of that report and even the begin of this numeric part. But I'm not sure it there is a way to check if the end of page is within the numeric part of report. Counting lines and determinating if the report is too long already to be breaken into more pages seems as terribly time consuming.

There is a little example of what I'm triing to get.

some data here
a lot of
"unimportant"
text and numbers
...
bla, bla...
...
*new page*
but now
it comes!
the numeric part
i am trying
to format:
123
222
*new page*
1534
1237
1324
end of report

As you can see, this text is long enough to be printed on more pages.
I don't care about the green *new page*. The red one is the important one.
I want to get the "useless" text to be printed on the one (two, three, doesn' matter) page and everything after "to format:" to be printed on the another page. I know that this "to format:" is static text printed in every case, but I'm not able to tel how many datas are befor and after this line.

Any ideas how to get this thing working?
Thank you for any suggestions.

DeadKing
10-21-2011, 05:22 AM
Hmm... I just found out that I can get the number of line of static text before numeric part and the one ending the report and just compare them.
I'm not sure if it is the best way, but it can do the trick, so consider this topic as solved.

DeadKing
10-21-2011, 05:25 AM
Ah and the link for the info that helped me - vbaexpress.com/kb/getarticle.php?kb_id=59
Thank you Steiner.