Results 1 to 3 of 3

Thread: [RESOLVED] print object multiple pages

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2007
    Location
    cobwebbed to PC
    Posts
    311

    Resolved [RESOLVED] print object multiple pages

    [vb6]
    Hi
    I have some code to print of a few pages with 3 columns, the first page has a title and a few details. at the end are some other details that occur only at the end.
    The columns are generated by a recursive loop returning values from a function.

    I can use .currentY to set the top margin on the first page but the second page starts printing straight at the top.
    It may be ,y printers settings as it is a networked office photocopier/scanner/printer/superman. and the second page is printed on the back of the first (which points me to the printer settings).

    But i was wondering If i was just coding it wrong instead? Code Below

    muchos gracias folks

    Code:
    Sub showDataReport()
    Dim intX As Integer
    Dim intI As Integer
    Dim intIMax As Integer
    Dim prtNum As String
    Dim prtQty As String
    Dim prtFault As String
    
    For intX = 0 To Printer.FontCount - 1
        If Printer.Fonts(intX) Like "Monospac821 BT" Then
            Printer.FontName = Printer.Fonts(intX)
            Exit For
        End If
    Next
    'Printer.CurrentY = 600     'Set top margin (Only does first page?)
    Printer.FontBold = True     'Makes Font Bold
    Printer.FontSize = 18       'Sets Heading Font Size
    
    Printer.Print ""
    Printer.Print ""
        pline = String(122, " ")
            Mid$(pline, 14, 27) = "Repair Station Scrap Report"
    Printer.Print pline
    
    Printer.FontBold = False
    Printer.FontSize = 12
        pline = String(122, " ")
            Mid$(pline, 36, 9) = "FCD#: XXX"
    Printer.Print pline
    
        pline = String(144, " ")
            Mid$(pline, 28, 26) = Date & " : " & Time & " : " + Left$(Users_FirstName, 1) + Left$(Users_Surname, 1)
    Printer.Print pline
    
    Printer.Print ""
    Printer.Print ""
        pline = String(144, " ")
            Mid$(pline, 15, 11) = "Part Number"
            Mid$(pline, 37, 8) = "Quantity"
            Mid$(pline, 56, 5) = "Fault"
    Printer.Print pline
    
    Printer.Print ""
    For Index = 12 To 16
        intIMax = getQuery(REPAIR_FORM.fault(Index).Caption)
        For intI = 1 To intIMax
            If (queryCount(intI) <> "") Then
                prtNum = Mid$(queryCount(intI), (InStr(queryCount(intI), ".") + 1))
                prtQty = Left$(queryCount(intI), (InStr(queryCount(intI), ".") - 1))
                prtFault = REPAIR_FORM.fault(Index).Caption
                'OP data to printer line
                    pline = String(144, " ")
                        Mid$(pline, 15, (Len(prtNum))) = prtNum
                        Mid$(pline, (40 - ((Len(prtQty)) / 2)), (Len(prtQty))) = prtQty
                        Mid$(pline, 56, (Len(prtFault))) = prtFault
                Printer.Print pline
            End If
        Next
    Next
    Printer.Print ""
    Printer.Print ""
    Printer.Print ""
    Printer.FontBold = True
        pline = String(144, " ")
            Mid$(pline, 5, 42) = "Team Leader Signature: ____________________"
            Mid$(pline, 52, 16) = "Date: __________"
    Printer.Print pline
    
    Printer.EndDoc
    End Sub
    PS: Idont want to use a data report, ta

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2007
    Location
    cobwebbed to PC
    Posts
    311

    Re: print object multiple pages

    used s counter that incremented everytime a line was printed and tested to see when the counter got to a certain number of lines then
    Printer.NewPage'd

    ta

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: print object multiple pages

    if you don't want to print on the back of the page, you can change the duplex property for your printing
    and the height property to work out how much page is left (as you do with the counter), but should be correct for the current paper size
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

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



Click Here to Expand Forum to Full Width