Printing page # of #
Thanks Thanks:  0
Likes Likes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Printing page # of #

  1. #1
    New Member
    Join Date
    Apr 2002
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    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
    PageCount=ExecuteExcel4Macro("Get.Document(50)")

    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.

    Lighting

  2. #2
    New Member
    Join Date
    Apr 2002
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Can someone help me with the following?

    I have to print an invoice which can change from 1 to 7 pages. I have set a print range and the rows that are empty I just delete them. By doing this the quantity of pages change. I have some repeated rows that have to print on each page.
    Now my problem begins. Somewhere in the repeated rows I have to print page # of #.
    I am doing this now by changing the numbers manualy and print each page seperetly. As this is taking allot of time I want to automate this process.
    Can someone help me out with a way to do that or a macro to do this.
    Thanks in advanced.

    Lighting

  3. #3
    Board Regular
    Join Date
    Mar 2002
    Location
    London, UK
    Posts
    167
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    before writing a complex macro, may i suggest that you use the "Rows to repeat at Top" to give you the repetition, and settle for just having a page footer with the "Page # of #" embedded in it?

    <table style="background-color:#0e54be" cellspacing="1" cellpadding="2"><td style="background-color:#ceffff;font-family:arial;color:#072c63;font-size:8pt;"> DALEY :P </td></table>

  4. #4
    New Member
    Join Date
    Apr 2002
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi daleyman,
    I can not do that as the invoice is in a pre define format that the company have for some years now. They use to fill this with a type writter.

    Lightman

  5. #5
    Board Regular
    Join Date
    Mar 2002
    Location
    London, UK
    Posts
    167
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    ah, beautiful tradition.

    If i came across this at work I would do a full overhaul of the worksheet and sell it to the managers as being worth the change.

    if that aint an option, the vba will really depend on the exact layout of your required solution. feel free to mail me with the workbook if it isn't too sensitive: david@monnetqos.com and i'll review it tomorrow.


    <table style="background-color:#0e54be" cellspacing="1" cellpadding="2"><td style="background-color:#ceffff;font-family:arial;color:#072c63;font-size:8pt;"> DALEY :P </td></table>

  6. #6
    New Member
    Join Date
    Apr 2002
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    daleyman,

    Thanks for your offer.

    I ahve just send you the file.

    Lighting

  7. #7
    Board Regular
    Join Date
    Mar 2002
    Location
    London, UK
    Posts
    167
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    for the benefit of the board, the initial solution looks like this...


    Public pagecount As Integer


    Sub print_all()
    pagecount = 4

    'set rows to repeat at top of each page and to fit to single page

    ActiveSheet.PageSetup.PrintTitleRows = "$69:$79"
    With ActiveSheet.PageSetup
    .FitToPagesWide = 1
    .FitToPagesTall = 1
    End With

    'print each page...

    print_page 80, 126, 1
    print_page 127, 177, 2
    print_page 178, 228, 3
    print_page 229, 279, 4
    print_page 280, 330, 5
    print_page 331, 381, 6
    print_page 382, 412, 7

    End Sub

    Sub print_page(startrow, endrow, pagenumber)

    'set "page # of #"
    Range("S70").Value = pagenumber & " of " & pagecount

    'set print area
    ActiveSheet.PageSetup.PrintArea = "$M$" & startrow & ":$W$" & endrow

    'print page
    ActiveWindow.SelectedSheets.PrintOut copies:=1

    End Sub




    would've liked to have the code work out how many pages and where the breaks should be, but the sheet layout was sporadic, so it would've got messy.

    Lightman, if you like send me it again with equal numbers of rows per section and i'll recode it, if you need it to be more flexible.

    <table style="background-color:#0e54be" cellspacing="1" cellpadding="2"><td style="background-color:#ceffff;font-family:arial;color:#072c63;font-size:8pt;"> DALEY :P </td></table>

  8. #8
    MrExcel MVP Jay Petrulis's Avatar
    Join Date
    Mar 2002
    Location
    Chicago, IL USA
    Posts
    2,040
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-04-13 17:48, Lighting wrote:
    Can someone help me with the following?

    I have to print an invoice which can change from 1 to 7 pages. I have set a print range and the rows that are empty I just delete them. By doing this the quantity of pages change. I have some repeated rows that have to print on each page.
    Now my problem begins. Somewhere in the repeated rows I have to print page # of #.
    I am doing this now by changing the numbers manualy and print each page seperetly. As this is taking allot of time I want to automate this process.
    Can someone help me out with a way to do that or a macro to do this.
    Thanks in advanced.

    Lighting
    Hi,

    This puts the Page # of ## in range M4 of the active sheet. Adjust to suit.

    ---begin VBA---
    Sub InsertPageNumData()

    Dim Pagecount as Integer
    Dim PageNumber as Integer

    PageCount = ExecuteExcel4Macro("Get.Document(50)")
    For PageNumber = 1 To PageCount
    Range("M4") = "Page " & PageNumber & " of " & PageCount
    ActiveWindow.SelectedSheets.PrintOut From:=PageNumber, To:=PageNumber
    Next PageNumber

    End Sub
    ---end VBA---

    HTH,
    Jay

  9. #9
    New Member
    Join Date
    Apr 2002
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks for the solutions.
    I'll test them Monday at work when I have the full access to all data and let you know how it turned out.
    Lighting

  10. #10
    New Member
    Join Date
    Apr 2002
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Bumb

    Don't see my post after last reply.

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
  •  

 

 
DMCA.com