You are here:

Visual Basic/Printing a file

Advertisement


Question
I am using VB6 and am trying to print a file without ever opening it. This can be accomplished outside of VB by right-clicking the file and then clicking 'Print'.

However, I would like to print files using this manner without opening the file in my application OR using code to physically right-click the file.

To clarify, I am trying to print a file by simply knowing it's path & filename. Certainly there is a way to do this in VB6.

I appreciate your help in advance!

Answer
Hi Enoctis,

I cannot provide you the complete code for now. But I can offer some tips. You would need to use the shell command in conjunction with the DOS type command to print the file without opening it.

This is to just emulate the DOS command type filetoprint.txt > prn, where the command (directs) prints the file "filetoprint.txt" to the printer.

Hope this helps.

Regards,

Amal

Visual Basic

All Answers


Answers by Expert:


Ask Experts

Volunteer


Amal Raj A

Expertise

Can answer basic VB questions those are related to commonly used controls, VB/Access related questions, basic Flexgrid solutions

Experience

I have working with VB-Oracle/Dbase/Access for the past 4 years.

Education/Credentials
Brainbench Certification in VB 6.0

©2012 About.com, a part of The New York Times Company. All rights reserved.