Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    922
    Thanks
    2
    Thanked 12 Times in 11 Posts

    Print Range of Pages (Word XP)

    I need to write code to print a range of pages. .. the current page and the following page.

    My code reads:

    dim s ' starting page number
    dim e ' ending page number
    s = Selection.Information(wdActiveEndPageNumber)
    e =s + 1
    ActiveDocument.PrintOut Range:=wdPrintFromTo, From:=s, To:=e

    Of course this is not right. If I were using known page numbers, the code would read:
    ActiveDocument.PrintOut Range:=wdPrintFromTo, From:="2", To:="3"

    How do I deal with the required quotes? Or do I need to?

    Thanks,
    Richard

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Print Range of Pages (Word XP)

    You can convert those numeric values to strings using CStr() --

    ActiveDocument.PrintOut Range:=wdPrintFromTo, From:=CStr(s), To:=CStr(e)

    I haven't tested this, but it seems to make sense. Does it work?

  3. #3
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    922
    Thanks
    2
    Thanked 12 Times in 11 Posts

    Re: Print Range of Pages (Word XP)

    Yes, it does. Thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •