Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing a text file

Status
Not open for further replies.

Stainnd

Programmer
Jul 9, 2001
65
US
This is a simple problem with most likely a simple answer. I have a textfile. I'd like to print it. Thanks for the help.

-Mike -Mike
 
dim filehandle as integer
dim strtemp as string

filehandle = freefile

open "c:\yourtext.txt" for input as filehandle

do untill eof(filehandle)
line input #filehandle, strtemp
printer.print strtemp
loop
printer.enddoc
close filehandle

I think this will work for you but there are other ways of doing this but i think this is probally the most general way of printing a text file. Another way you could do this is by changing the extension of the text file to rtf (rich text file) and open with

dim objectvar as object
set objectvar = getobject("mytext.rtf")

and use the microsoft word object which does have a print method.

Need any other help let me know. hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top