Any one know a fast way to print a file to printer?
Printable View
Any one know a fast way to print a file to printer?
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
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