Does the actual print command that you are trying to execute run OK from a command prompt outside of the program?
Look at the value of the printer-name2 variable when executing the program and replace the variable below with the actual value:
Open up a command prompt and type the command:
PRINT /D:PRINTER-NAME2 C:\TEMP\PRINT.FIL
does this work?