Thanks Kyle!! That worked!!!
N.T.GOPALAKRISHNAN
----- Original Message -----
From: Kyle Burns
To: professional vb
Sent: Saturday, September 08, 2001 2:59 AM
Subject: [pro_vb] RE: Print from DOS based programs
PRN is not the Windows default printer. It's probably LPT1. Just a
suggestion, but could you not get the network path of the desired
printer,
issue "NET USE LPT2 \\servername\printername", and then have the batch
file
read "COPY %1 LPT2"?
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D
Kyle M. Burns, MCSD
ECommerce Technology Manager
Centra Credit Union
kburns@c...
-----Original Message-----
From: Gopalakrishnan [mailto:ntg@s...]
Sent: Friday, September 07, 2001 7:41 AM
To: professional vb
Subject: [pro_vb] Print from DOS based programs
hi everybody,
I added a printer (HP LaserJet 4000 PCL 5e) to my system (which is
a
network printer) and I said YES to "Print from MS-DOS based Programs",
asked in the wizard.
I then wrote a batch file, called "printer.bat", which has the
following one line code:
TYPE %1 > PRN
where %1 will be the file to be printed.
And in my VB program, I use the following code:
' --- Code Starts Here... ---
Dim sDeviceName as String
CommonDialog1.ShowPrinter
' I select the HP LaserJet 4000 PCL 5e printer said above
sDeviceName =3D Printer.DeviceNameMsgBox sDeviceName
' Making HP LaserJet 4000 PCL 5e as default printer so that when
prints
thro the Dos mode, it directs it to that printer.
SetDefaultPrinter sDeviceName
'Executing the batch file through the Shell command
Shell "c:\windows\desktop\printer.bat
c:\windows\desktop\productlink.txt",
vbNormalFocus
'---- End of the Code ---
I thought that the above command will execute the batch file, which in
turn
print to the changed Default Printer (ie the HP LaserJet 4000 PCL 5e).
But
it didn't happend like that and it always point to my local printer.
WHY?
Any help is appreciated.
Thanks,
N.T.GOPALAKRISHNAN