Can anyone tell me how to sequentially send text to a file and then print it out? Thanks in advance.
Printable View
Can anyone tell me how to sequentially send text to a file and then print it out? Thanks in advance.
In case I really wasn't clear, I just need to know how to print a document, I'm sure I could figure out how to send the text, I just need to find out how to print it.
You can use the Printer object directly, doing something like this:
dim sMyString as string
sMyString = "Hello World!"
Printer.Print sMyString
This will send the sMyString variable directly to the printer. Just use Printer.EndDoc to stop the buffer, and start the printing.
Daryl
What about a file? I am wanting to send a series a strings to a file, save that file, then print it using VB.
You can load the text into a string and then send it to the printer via the printer object
Printer.print mystring
Printer.enddoc
or load the file into a RichTextBox and use
RTB1.selPrint(Printer.hDC)
With the RTB you could add color or formatting or whatever
To open the file into a string look up the FileSystemObject and OpenAsTextStream
Thanks, that one's been bugging me a while.