Click to See Complete Forum and Search --> : Silly, Print Help


Shiv Kumar G.M.
September 21st, 2001, 04:59 AM
I have a Txt file a.txt in c:

I want to take the print out of the file through DOs something like c:\a.txt > prn

I don't want any windows print out becaues it is too slow.

I am doing something like this :

a = Shell("cmd.exe")
SendKeys "Type C:\dirbat.txt >prn"


This opens too many dos prompts and there is no result at end.

I need this urgently,

Thanks,
Shivakumar G.M.

Cakkie
September 21st, 2001, 07:09 AM
Maybe this can help, instead of sending the file to the printer, send the file to a .prn file, then shell a batch file that sends that file to the printer. Sending a .prn file to a printer can be done using copy, like this

copy output.prn LPT1
or
copy output.prn \\SomeServer\SomeSharedPrinter

This however requires that the file is printed to a file using the printer API's, like when you select the checkbox 'print to file' in the common dialog.


Tom Cannaerts
slisse@planetinternet.be

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook

dcaillouet
September 21st, 2001, 07:27 AM
Would something like this work?

Open "C:\Print.bat" For Output As #1
Print #1, "Type C:\dirbat.txt > prn"
Close #1
Shell "C:\Print.bat", vbHide

Shiv Kumar G.M.
September 22nd, 2001, 05:37 AM
Thanks a lot, it works great.

sir, what I had done right now was, I made a EXE file in C which accepts a command line argument that is the name of the file like
shell("printMe a.txt")

The c file internally gives a command like
system("Type a.txt > PRN")


Your example works fine.

Thanks.
Shivakumar G.M.