Question

Locked

VBA: print .prn files to a network printer using LPR

By j_kooijman ·
I have this Word VBA code that merges a number of documents into .PRN files.

Next I want to send these .PRN files to a network printer using the lpr command.

At this moment I try to do this with the following piece of code:

' Send PRN files to Emtex
Call Shell("lpr -S 10.x.x.x -P dl-pcl" & strPath & "*.prn")

when debugging the code the step is passed without errors but no files appear in the printerqueue.

Does anyone have an idea how to do this?

Thanks in @vance
Jaap

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
Thread display: Collapse - | Expand +

All Answers

Collapse -

will it work with an explicit filename ?

by robo_dev In reply to VBA: print .prn files to ...

instead of the *.prn

do you have to make it loop recursively to read in the files one at a time?

another method is to create a batch file on your desktop with a substitution variable e.g.:

LPR -S 10.x.x.x -P dl-pcl %1

Then you drag and drop your prns to the batch file and they print.

http://testdrive.mapinfo.com/TechSupp/MIProd.nsf/2dcd2e03799251b185257125006b1089/459e6df99b9944**85256a110075acda?OpenDocument

Collapse -

CMD line does work

by j_kooijman In reply to will it work with an expl ...

When I translate the variables into the right path and filename and enter the command from the command line.
then the files are transfered

this can mean two things, either the variables are not translated correctly
or, the shell command is not performed

I don't know how to test this

when I google on this shell(lpr .... command, I think I use it right

Thank you for the Drag&Drop alternative, only I need to make this unattended, just start the macro and forget

Back to Peripheral Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums