Results 1 to 3 of 3

Thread: Printing Files

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2000
    Posts
    69
    Any one know a fast way to print a file to printer?

  2. #2
    Addicted Member
    Join Date
    Nov 2000
    Posts
    217
    Sure..

    Code:
    Option Explicit
    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    
    Private Const SW_SHOWNORMAL = 1
    
    Private Sub Command1_Click()
        Dim rc As Long
        rc = ShellExecute(hwnd, "Print", "c:\test.txt", vbNullString, "c:\Windows", SW_SHOWNORMAL)
    End Sub

  3. #3
    Lively Member
    Join Date
    Jan 2001
    Location
    St. Louis, MO USA
    Posts
    77
    Here's another way:


    Dim strString As String
    Open "C:\windows\desktop\test.txt" For Input As #1
    While Not EOF(1)
    Line Input #1, strString
    Printer.Print strString
    Wend
    Close #1

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