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

How to print document frm WordPad? Pls help!

Status
Not open for further replies.

jche

Programmer
Nov 5, 2002
4
0
0
SG
Hi there
I need to automate the printing of wordpad documents using VB. The following code is what I have written :-

Dim filename As String
Dim wp As String
Dim actApp As String


filename = "test1.txt"
wp = "c:\wordpad.exe c:\MyDocuments\" + filename
Shell wp

' to change focus to WordPad app
actApp = filename + " - WordPad"
AppActivate actApp

I believe the above will make the wordpad application window active. But what do I do next to change the left and right margins of the document and print from here?

I need to open up the document in order to print becoz the document contains Chinese characters. So I need to open up the document so that a Chinese translator software at my PC will display them correctly before printing. Pls help and advise. Thanks alot for your kind attention.

Rgds
jche...
 
Wordpad is not COM compliant and therefore not suitable for automation. You should use the full version of Microsoft Word to expose the functionality you're looking for.

Otherwise you'll have to write your own 'WordPad' using an rtf control. VBSlammer
redinvader3walking.gif

Unemployed in Houston, Texas
 


Shell "C:\Program\WORDPAD.EXE C:\aTextFile.txt /p"

/p for print


®od

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top