To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
Part 10 of the Visual Basic .NET 2010 Express Tutorial Complete!
How to Use the Visual Studio Code Analysis Tool FxCop
Article :: Interview with Andrei Alexandrescu (Part 3 of 3)
Introducing Visual Studio LightSwitch
Visual Studio LightSwitch Beta 1 is Available



Go Back   VBForums > Visual Basic > Visual Basic 6 and Earlier

Reply Post New Thread
 
Thread Tools Display Modes
Old May 28th, 2007, 09:15 AM   #1
wolf99
Addicted Member
 
Join Date: Apr 07
Location: cobwebbed to PC
Posts: 183
wolf99 is an unknown quantity at this point (<10)
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
wolf99 is offline   Reply With Quote
Old May 28th, 2007, 10:15 AM   #2
wolf99
Addicted Member
 
Join Date: Apr 07
Location: cobwebbed to PC
Posts: 183
wolf99 is an unknown quantity at this point (<10)
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
wolf99 is offline   Reply With Quote
Old May 28th, 2007, 04:37 PM   #3
westconn1
PowerPoster
 
Join Date: Dec 04
Posts: 13,424
westconn1 is a splendid one to behold (700+)westconn1 is a splendid one to behold (700+)westconn1 is a splendid one to behold (700+)westconn1 is a splendid one to behold (700+)westconn1 is a splendid one to behold (700+)westconn1 is a splendid one to behold (700+)westconn1 is a splendid one to behold (700+)
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
westconn1 is online now   Reply With Quote
Reply

Go Back   VBForums > Visual Basic > Visual Basic 6 and Earlier


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:30 AM.





Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.