Results 1 to 5 of 5

Thread: Printing a File...

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    Dallas, TX
    Posts
    89
    Hi All,

    How do you print a simple Text file through code?
    ande211
    VB6 SP3

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Code:
    Open "File.txt" For Input As #1
      strTemp = Input(LOF(1),1)
      Printer.Print strTemp
      Printer.EndDoc
    Close #1
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Get up to get a tea and someone beats you to the punch!

    Code:
    'Read a complete file instead of line by line
    
    Option Explicit
    
    Private Sub Command1_Click()
    
        Dim sfile As String, intNum As Integer
        Dim sString As String
        
        intNum = FreeFile
        sfile = "C:\my Documents\myfile.txt"
        
        Open sfile For Input As intNum
        sString = StrConv(InputB(LOF(intNum), intNum), vbUnicode)
        Close intNum
        Printer.Print sString
        Printer.EndDoc
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  4. #4
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    ummmmmmmm...yeah...

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    Dallas, TX
    Posts
    89
    Thanks to both of you.
    ande211
    VB6 SP3

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