Solved

Print to file

Posted on 1998-12-07
3
165 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

749 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