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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print data to wordpad application

Status
Not open for further replies.

wvdw

Programmer
Jul 31, 2000
20
NL
Hi,

I want to send data from a form to wordpad. I know how to open word and print lines to the newly created files. But because I don't know if customers have installed Word and it takes a lot of processing time I want to print the lines to wordpad. Can somebody tell me how to start wordpad (as an object) so I can write lines to that application?

thanks.
 
In my opinion the best solution would be to print to a txt file, which can be opened on any computer.

To do so you must:
1. Open the file for output:
Open "C:\test.txt" for output as #1

2. Print the data
Print #1, data (note that every print statement stands for a new line)

3. Close the file after printing the data
Close #1

Have fun,

ElGuapo
 
Hi ElGuapo,

Thanks for the quick reply. But the problem is that I want to show the output on screen. If I write the lines to a textfile (and open that in Wordpad) I will get the problem that the file can be already in use and I have to test it etc, etc,

So I really want to open wordpad and show the data onscreen (preview of the created textfile).

Regards.
 
Then the solution for you might be the sendkeys() function wich simulates your input in the wordpad file. It is clearly explained how it works in the VBA help. Simply open the wordpad file you want to edit using VBA and then send the input to wordpad via sendkeys() function. I use it quite often and it woks fine for me.

Regards

ElGuapo
 
The problem is that I do not want to create a file (not on disk anyway). I just want to open Wordpad and control the wordpad window like I control word with automation. The sendkeys option is OK i will try that.

Thanks


wvdw
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top