I am to build a template for users to use and what it is to have is a button
that prints our specific sections of text. Basically, a user locates a
heading in the document and then clicks on the button and the code in the
button has to figure out how many pages are under that heading and print
them. How would I code something like that?

Re: Blind print out of pages by Doug

Doug
Thu Jun 26 14:08:45 PDT 2008

It would be easy if each heading was in a separate Section.

Dim i As Long
i = Selection.Information(wdActiveEndSectionNumber)
ActiveDocument.PrintOut Range:=wdPrintRangeOfPages, Pages:="s" & i

If that is not the case, the easiest thing to do might be to use a macro to
insert a Section Break before each heading.

--
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

"Cameron" <Cameron@discussions.microsoft.com> wrote in message
news:D4C38FA1-4702-4A4B-9552-90C5FC69F064@microsoft.com...
>I am to build a template for users to use and what it is to have is a
>button
> that prints our specific sections of text. Basically, a user locates a
> heading in the document and then clicks on the button and the code in the
> button has to figure out how many pages are under that heading and print
> them. How would I code something like that?



Re: Blind print out of pages by Cameron

Cameron
Thu Jun 26 14:53:01 PDT 2008

Is there an example of how to insert section breaks using a macro? I know
they want to build these documents with tables of contents and then hyperlink
to the various headings.

"Doug Robbins - Word MVP" wrote:

> It would be easy if each heading was in a separate Section.
>
> Dim i As Long
> i = Selection.Information(wdActiveEndSectionNumber)
> ActiveDocument.PrintOut Range:=wdPrintRangeOfPages, Pages:="s" & i
>
> If that is not the case, the easiest thing to do might be to use a macro to
> insert a Section Break before each heading.
>
> --
> 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
>
> "Cameron" <Cameron@discussions.microsoft.com> wrote in message
> news:D4C38FA1-4702-4A4B-9552-90C5FC69F064@microsoft.com...
> >I am to build a template for users to use and what it is to have is a
> >button
> > that prints our specific sections of text. Basically, a user locates a
> > heading in the document and then clicks on the button and the code in the
> > button has to figure out how many pages are under that heading and print
> > them. How would I code something like that?
>
>
>