Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Print the content of the text file

Posted on 1999-07-19
2
Medium Priority
?
157 Views
Last Modified: 2010-04-30
Hi,

How to print line by line of text file content?

Here is my example. I have one text file called myprofile with 3 line as follow:

line 1 : myname
line 2 : myage
line 3 : mydob

I want the program to read this myprofile.txt and assign line by line to a variable until end of file. Then print out this text file content.

Help please.

Thanks.
0
Comment
Question by:hltan
[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
2 Comments
 
LVL 6

Accepted Solution

by:
setiawan earned 100 total points
ID: 1525739
Sub CopyToPrinter()
  Open "textfile.txt" For Binary As 1
  Open "LPT1:" For Binary As 2
   
  Do Until EOF(1)
    Get #1, , a
    Put #2, , a
  Loop
   
  Close 2
  Close 1
End Sub


0
 
LVL 6

Expert Comment

by:setiawan
ID: 1525740
Dim sFileName As String
Dim sData As String
Dim iFileNum As Integer

iFileNum = FreeFile
sFileName = "C:\gwdbg32.txt"
Open sFileName For Input As iFileNum
Do Until EOF(iFileNum)
    Line Input #iFileNum, sData
    Printer.Print sData
Loop
Printer.EndDoc
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Suggested Courses

705 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