Solved

Print to file

Posted on 1998-12-07
3
163 Views
Last Modified: 2010-05-03
I am trying to print a document to a file instead of to the printer using VB5.  I tried the "print#1" route, but keep getting file already open, even though I'm using a different file with a different name, etc.  Is there another way I can print a printer document to a file?
0
Comment
Question by:bmilne
3 Comments
 
LVL 2

Accepted Solution

by:
Bhargava earned 50 total points
ID: 1448594
See if this helps.
The file # your using should not be a constat.
Use FreeFile function to get the free file # and try printing the file.
0
 

Expert Comment

by:singe
ID: 1448595
This seemed a little unclear to me even though I know what Bhargava was trying to say. Try following these steps:

1. Declare a variable as an integer

2. Assign a valid file handle to that variable by calling:
 (variable) = FreeFile

Don't forget to open, close, and print using only this file handle, and that each file handle may only be used for one open file. To open multiple files, you will need to get multiple free file handles...

Singe
0
 

Expert Comment

by:swathi
ID: 1448596
 let printer document be file_tobe_printed .
you can use following code:

      num1=FreeFile
      open file_tobe_printed For Binary As #num1
      num2=FreeFile
      open new_file For BInary As #num2
      while( Not EOF(num1))
          get  #num1, ,Chunk
          put #num2, .Chumk
       wend
      Close #num2
      Close #num1
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now