Re: Section Break and a New Page by PastorHank
PastorHank
Sun Feb 12 17:09:27 CST 2006
Hi Bernard,
Here's what's happening. I ran a macro and manually inserted a new page and
got this code (modified from the VBA version)
oRange.MoveEnd( wdStory)
oRange.Collapse( wdCollapseEnd )
With oRange
.Collapse Direction = wdCollapseEnd
.InsertBreak Type=wdPageBreak
EndWith
This is right before where the program loops back to a Do While !eof()
statement that is processing the data
Now what's happening is that the document is rewriting the first page.
Things return to the top of the page, and the page fills in with the next set
of data, but instead of having 12 pages (one for each master record) I have 1
page, with the page showing only. It's just returning to the top of the
previous or last page. The page has 4 tables on it, do I need to renumber
the tables each time?, I've tried incrementing the sections[], to no avail....
Hank
"Bernhard Sander" wrote:
> Hi Pastor Hank,
>
> > OK, I think this is my last question (man I hope....anyway), reading the VBA
> > help files, I have found the insertbreak type=wdPageBreak, and have tried
> > tying it to a new section, but what happens in my original page just gets
> > overwritten,so where I should have 12 pages, I have 1, the data is changing
> > correctly, but the new page isn't there....I can't find a simple AddNewPage,
> > and I'm a tad confused by the sections() vs range stuff.....
> a nice way to find out what and how to do: go to word and record a macro with
> the steps you need. Then have a look at the recorded macro. Often you can
> translate the macro 1:1 to foxpro.
>
> A section is part of the document hierarchy:
> a Document is at top level. It contains one or more section. There is at least
> one section in a document.
> A section is at second level. It contains one or more paragraphs. Again there is
> at least on paragraph in a section.
> A paragraph contains text and other objects.
>
> A range is an object you can use in macros (or from foxpro). A range can contain
> a large or a small part of a document. It is something like a invisible
> "selection".
> But don't mix it up with the object "selection". This is a selected part of your
> document, you can see the selection in the document window of word. You can have
> not more than one selection object at a time, whereas you can have different
> range objects.
>
> HTH
> Regards
> Bernhard Sander
>