NEWBIE NEEDS HELP PRINTING

Can someone please tell me how to get this to print. I am using VB6 and I have a print button on my form, but do not know how to make it print.
Many thanks.


Private Sub Command3_Click()
Open "C:WINDOWSDesktopNew Folder (2)DM-ARC.WRI" For Output As #1 ' Open file for output.

Print #1, Spc(35); "DM - ARC" ' Print text to file.
Print #1, Spc(33); "Simple Skid"
Print #1, ' Print blank line to file.
Print #1, "Date:"; " "; Date
Print #1,
Print #1, "Drivers Name:"; Tab(50); "ARC Inspector:" ' Print in two print zones.
Print #1, "Address:"; Tab(50); "Address:"
Print #1, "Phone:"; Tab(50); "Phone:"
Print #1,
Print #1, "Location of Accident:"
Print #1,
Print #1, "Description of accident:"
Print #1,
Print #1,
Print #1,
Print #1, "The vehicle was going at least"; " "; Text4; " "; "mph at the beginning of the skid."
Print #1,
Print #1, Spc(5); Text4; " "; " = Sqr(30 * "; Text1; " * "; Text2; " * "; Text3; ")"
Close #1 ' Close file.
MsgBox "The file is located in the ARC folder on your desktop."

End Sub

Comments

  • : Can someone please tell me how to get this to print. I am using VB6 and I have a print button on my form, but do not know how to make it print.
    : Many thanks.
    :
    :

    this has worked useing the 'printer' object-

    [code]
    Private Sub DataPrint()
    Dim i, j As Integer, FS As String

    On Error GoTo ErrPrint

    'SET PRINTER PARAMETERS
    Printer.TrackDefault = True
    Printer.FontName = "Courier": FS = "10" SET FONTNAME,SIZE
    If mnuFont08.Checked = True Then FS = "8"
    If mnuFont10.Checked = True Then FS = "10"
    If mnuFont12.Checked = True Then FS = "12"
    If mnuFont14.Checked = True Then FS = "14"
    If mnuFont16.Checked = True Then FS = "16"
    Printer.FontSize = FS

    If PrintOk = False Then Exit Sub 'CANCEL

    'PRINT REPORT
    Printer.Print "Contract No.", , Cnum
    Printer.Print "Description:", , Desc
    Printer.Print "Location:", , Location
    Printer.Print "Hammer Model:", , Model
    Printer.Print "Hammer Type", , Htype

    Printer.Print "Ram Weight (kips)", Ramwgt
    Printer.Print "BPM start value", BPMstart '5-12-03
    Printer.Print "BPM end value", BPMend '5-12-03
    Printer.Print "Required Bearing (tons)", RBorig
    Printer.Print "Required Batter (ratio)", Ratio
    Printer.Print "Bearing Range (ton)", Init & " - " & Final
    Printer.Print "Date", , Curdate
    Printer.Print vbCr & vbCr

    Printer.Print vbCr
    Printer.Print "Prepared by: " & Prepare
    Printer.Print "Date: " & Curdate
    Printer.Print
    Printer.Print "Chief: _________________________ RCE: _________________________"
    Printer.EndDoc

    MsgBox "Results were sent to printer.", vbOKOnly, "Print status"
    xit:
    Exit Sub

    ErrPrint:
    MsgBox Err.Description, vbExclamation, Err.Number
    Resume xit
    End Sub
    [/code]
  • : : Can someone please tell me how to get this to print. I am using VB6 and I have a print button on my form, but do not know how to make it print.
    : : Many thanks.
    : :
    : :
    :
    : this has worked useing the 'printer' object-
    :
    : [code]
    : Private Sub DataPrint()
    : Dim i, j As Integer, FS As String
    :
    : On Error GoTo ErrPrint
    :
    : 'SET PRINTER PARAMETERS
    : Printer.TrackDefault = True
    : Printer.FontName = "Courier": FS = "10" SET FONTNAME,SIZE
    : If mnuFont08.Checked = True Then FS = "8"
    : If mnuFont10.Checked = True Then FS = "10"
    : If mnuFont12.Checked = True Then FS = "12"
    : If mnuFont14.Checked = True Then FS = "14"
    : If mnuFont16.Checked = True Then FS = "16"
    : Printer.FontSize = FS
    :
    : If PrintOk = False Then Exit Sub 'CANCEL
    :
    : 'PRINT REPORT
    : Printer.Print "Contract No.", , Cnum
    : Printer.Print "Description:", , Desc
    : Printer.Print "Location:", , Location
    : Printer.Print "Hammer Model:", , Model
    : Printer.Print "Hammer Type", , Htype
    :
    : Printer.Print "Ram Weight (kips)", Ramwgt
    : Printer.Print "BPM start value", BPMstart '5-12-03
    : Printer.Print "BPM end value", BPMend '5-12-03
    : Printer.Print "Required Bearing (tons)", RBorig
    : Printer.Print "Required Batter (ratio)", Ratio
    : Printer.Print "Bearing Range (ton)", Init & " - " & Final
    : Printer.Print "Date", , Curdate
    : Printer.Print vbCr & vbCr
    :
    : Printer.Print vbCr
    : Printer.Print "Prepared by: " & Prepare
    : Printer.Print "Date: " & Curdate
    : Printer.Print
    : Printer.Print "Chief: _________________________ RCE: _________________________"
    : Printer.EndDoc
    :
    : MsgBox "Results were sent to printer.", vbOKOnly, "Print status"
    : xit:
    : Exit Sub
    :
    : ErrPrint:
    : MsgBox Err.Description, vbExclamation, Err.Number
    : Resume xit
    : End Sub
    : [/code]
    :
    Thanks, but I get an "Object variable or With block variable not set" message when I run this. It did say sent to printer but nothing happened.
  • [b][red]This message was edited by dokken2 at 2006-8-23 4:43:42[/red][/b][hr]
    : Thanks, but I get an "Object variable or With block variable not set" message when I run this. It did say sent to printer but nothing happened.
    :

    probably since there are variables from the program and they are undefined in the excerpt of code. this example should get you started-

    [code]
    'SET PRINTER PARAMETERS
    Printer.TrackDefault = True
    'SET FONTNAME,SIZE
    Printer.FontName = "Courier"
    Printer.FontSize = "10"

    'PRINT
    Printer.Print "send to the printer"

    'END OF DOCUMENT
    Printer.EndDoc
    [/code]


  • : [b][red]This message was edited by dokken2 at 2006-8-23 4:43:42[/red][/b][hr]
    : : Thanks, but I get an "Object variable or With block variable not set" message when I run this. It did say sent to printer but nothing happened.
    : :
    :
    : probably since there are variables from the program and they are undefined in the excerpt of code. this example should get you started-
    :
    : [code]
    : 'SET PRINTER PARAMETERS
    : Printer.TrackDefault = True
    : 'SET FONTNAME,SIZE
    : Printer.FontName = "Courier"
    : Printer.FontSize = "10"
    :
    : 'PRINT
    : Printer.Print "send to the printer"
    :
    : 'END OF DOCUMENT
    : Printer.EndDoc
    : [/code]
    :
    That did the trick......thank you very much.....you guys and girls are great.
    :
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories