donramesh Level: Guest

|
Re: Printing through API
Hi thiru, Just try this code
Probably u can use the printer.port to identify the port and print a text file directly.
No need for APIs
-------------------------------------------------------------------
Private Sub PrintDirectly()
Dim strFilename As String
Dim strLine As String
strFilename = InputBox("Enter the file name to print", "Filename to print")
If InStr(UCase(Printer.Port), "LPT") <> 0 Then
Open Printer.Port For Output As #1
Open strFilename For Input As #2
Do Until EOF(2) = True
Line Input #2, strLine
Print #1, strLine
Loop
Close #2
Close #1
Else
If Not bAlert Then MsgBox "Default printer is not set to LPT port."
End If
End Sub
-------------------------------------------------------------------
|