Solved

Print a Text File

Posted on 2000-02-23
4
296 Views
Last Modified: 2010-05-02
Can I print a .txt file without opening it first? No formatting or page breaks are required. All I would need is for the program to print a predetermined file name and quit.
0
Comment
Question by:DonH040699
[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
  • 2
4 Comments
 
LVL 7

Accepted Solution

by:
kamall earned 35 total points
ID: 2553161
Open "c:\myfile.txt" For Input As #1
Do while Not Eof(1)
   Line Input #1, x$
   Printer.Print x$
Loop
Close 1
Printer.EndDoc

0
 
LVL 5

Expert Comment

by:KDivad
ID: 2553284
Without opening it? Sure, if you don't mind "bouncing" it off command.com.

x = Shell("command /c copy " & MyFile & " lpt1")
0
 

Author Comment

by:DonH040699
ID: 2567112
Kamall,

I put your suggested code in a function and it worked great. VB showed me what else I could do with Print. and I wound up with a very useful untility. Thanks!
0
 
LVL 7

Expert Comment

by:kamall
ID: 2582143
You are welcome.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

733 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