How does macro know it has gone to next page

S

Sukhi

I have VB program writing various paragraphs.
On top of every new page, my program needs type something like '...Continued'

How would my macro know that it has gone on to new page or can I do it some
other way, ie. include it in template, but how?
 
C

Cooz

Hi Sukhi,

Open your document.
Choose File | Page Setup... | tab Layout
Check "Different first page"
Click OK
If your document has only one page, go to the end of the document and press
Ctrl-Enter to insert a page break.
Choose View | Header and Footer
Type ...Continued
Close the Header (and Footer)
If you inserted a page break to obtain a second page, press Backspace to
delete it now.
Save your document.

....Continued will automatically appear on the top of all pages, except the
first.

Success,
Cooz
 
S

Sukhi

Cooz
I have range object (inside table), that inserts paragraphs, tables so on.
I want to insert 'Continued' when my range object moves on to next page, not
necessarily when the document moves to next page.

My range object is in the middle of page and there is some static text at
the bottom of the page.

may be checking for - -
rBMRange.information(wdActiveEndPageNumber) will do, but do I have to keep
 
D

Doug Robbins - Word MVP

Pages in Word do not mean much as the pagination can vary depending upon the
active printer.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
C

Cooz

Hi Sukhi,

.... and if the entire range moves to the next page "Continued..." will have
to disappear, I guess. Well, this can be done.

Place a bookmark at the beginning of the range (say, "StartR").
Place a bookmark at the end of the range (say, "EndR").
Activate the header.
Insert the following field (by pressing Ctrl-F9 to insert the { } and typing
the rest):

{ IF s < e { IF { PAGE } <= e { IF s < { PAGE } "Continued..." } } }

Choose Insert | Reference > Cross-reference...
In the dialog, choose 'Bookmark' as Reference type, end choose 'Page number'
under 'Insert reference to:'
Now, replace s in the field by a cross-reference to StartR, and replace e by
a cross-reference to EndR.
Done.

"Continued..." appears on the current page whenever the 'StartR-page' comes
before the 'EndR-page' AND the current page is either the 'EndR-page' or
comes before it, AND the 'StartR-page' comes before the current page. The
last AND-phrase prevents "Continued..." to appear on pages before the
'StartR-page'.

Thanks to a few nightly hours in which sleep wouldn't come. :)

Success,
Cooz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top