print code variant of Doug Robbin code

C

cmledbetter

I have an online form that is 12 pages but will need to print pages 1-9
(ending number may vary) then always print pages 10-12. I can have a user
form to determine the ending point for the first part of my pages string but
I am not sure the correct coding statement and syntax to substitute in the
following line of code found from Doug Robbin

ActiveDocument.PrintOut Range:=wdPrintFromTo, From:="1", To:="5"

I am planning to hijack the PrintOut and wdDialogFilePrint calls to insert
the correct code to just print my requested pages.

I think something likethis may work but not so far:
ActiveDocument.PrintOut Range:=wdPrintPages, (1-vPrintPages,10-12)

cannot get this to work but also cannot find documentation to help with
syntax.

One last part I would also like for my pages x of y to reflect the correct
pages once the pages are omitted.


Advice Appreciated
 
D

Doug Robbins - Word MVP

ActiveDocument.PrintOut Range:=wdPrintRangeOfPages, Pages:="1-" &
vPrintPages & ", 10-12"

For the second part, are you saying that if you only print pages 1 - 3 and
10 - 11, that you want the pages numbered 1 of 6, 2 of 6, etc.

To do that, you would have to a field construction in the footer of the
document like

{ IF { Page } < 10 { Page } { = { Page } - 9 + {Docvariable varpages }) } of
{ = { Docvariable varpages } + 3 }

And in your code you will need to set the value of a document variable
varpages to the number of the pages before page 10 that you want to print
out.

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

cmledbetter

Doug

That looks great I think that this is going to work should be able to test
this evening. We have had a issue in the family so my time is a little
stretched right now. Mother-in-law passed following fight with cancer. She is
where she wants to be so no grief. But anyway both code snippets make sense
to me. That may be a bit scary since this vba coding is relatively new to
me. But I will post results once completed. Your help is sincerely
appreciated. Both this post and other tips, snippets and code that are
accessible on the net.

Cecil Ledbetter
 

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