Thanks Thanks:  0
Likes Likes:  0
Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: Printing page # of #

  1. #11
    MrExcel MVP Jay Petrulis's Avatar
    Join Date
    Mar 2002
    Chicago, IL USA
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)


    On 2002-01-14 17:52, Lighting wrote:
    Had to go to work on Sunday to test it out. Couldn't wait till tommorrow.

    daleyman, your solution worked, but as some rows got deleted and pagecount changes it still prints 7 pages. I got for example page 7 of 4. So it didn't suite me completly. Thanks anyway.

    Jay Petrulis macro was just what I needed. It worked perfectly. Thanks.
    Can you please explain what the following means and do?

    Dim Pagecount as Integer
    Dim PageNumber as Integer

    And I bother you a little more.
    Can you please add a code that let me choose how many copies I want to print.
    Thanks in advance.


    The following prompts you for the number of copies you would like to print.

    Sub InsertPageNumData()

    Dim Pagecount As Integer
    Dim PageNumber As Integer
    Dim NumCopies As Integer

    NumCopies = Application.InputBox("Enter the number of copies you would like", , 1)
    With ActiveSheet
    Pagecount = ExecuteExcel4Macro("Get.Document(50)")
    For PageNumber = 1 To Pagecount
    .Range("D4") = "Page " & PageNumber & " of " & Pagecount
    .PrintOut From:=PageNumber, To:=PageNumber, Copies:=NumCopies
    Next PageNumber
    End With
    End Sub

    For your other questions, the DIM statements are short for Dimension, as you set these to allocate memory to the variable. It also forces the variable to be an integer in this case.

    The Excel4 macro is a throwback to the days before VBA. These functions are still available, although I don't have a full list.

    This particular one finds the number of pages in the range (akin to clicking Print Preview).


    [ This Message was edited by: Jay Petrulis on 2002-04-15 08:00 ]

  2. #12
    New Member
    Join Date
    Apr 2002
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)


    Thanks Jay

    Runs like a train.


Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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