edkoo
asked on
Printing a file
My question is, after i have print (any doc) to file..how can i can use vb to send these files to printer directly ?
Like in ms-dos command where we can use "copy" command to do that. Please help. Thanks
Like in ms-dos command where we can use "copy" command to do that. Please help. Thanks
Using the ShellExecute API and using "Print" as command.
You have two methods of printing a file directly to the printed without going through an application layer.. similar to dos copy file lpt1:
Method 1
Printer.FontName = "Courier New"
Printer.FontSize = "10"
'Open your file
'While not at the end of your file
'Read a line from the file into var LineFromFile
Printer.print LineFromFile
Printer.NewPage
Printer.EndDoc
If you like I can give you the complete code including how to select the printer..
Method 2:
Shell("cmd /k copy yourfilename.ext lpt1")
Let me know
Method 1
Printer.FontName = "Courier New"
Printer.FontSize = "10"
'Open your file
'While not at the end of your file
'Read a line from the file into var LineFromFile
Printer.print LineFromFile
Printer.NewPage
Printer.EndDoc
If you like I can give you the complete code including how to select the printer..
Method 2:
Shell("cmd /k copy yourfilename.ext lpt1")
Let me know
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.