Print Pages

J

Jules

I am trying to set up a macro where the user inserts a page number or range
of pages into a text box (in a userform) and the macro then prints only those
pages of the active document.

I know the syntax for printing only certain pages (if you know what those
pages are) is
ActiveDocument.PrintOut Range:=wdPrintRangeOfPages, Pages:="2, 6-10"

I have defined the text from the text box as a string called "MyPages" but
everything I try does nothing.

What would I put instead of "2, 6-10" as above to get the macro to print the
string of pages from the text box?

thanks,
 
D

Doug Robbins - Word MVP

The following works for me:

Dim Pages As String
Pages = InputBox("Enter the range of pages to be printed.")
ActiveDocument.PrintOut Range:=wdPrintRangeOfPages, Pages:=Pages


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

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