Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to find and use properties of MS WordPad

schiavosschiavos Member Posts: 9
Since VB2005 has such awkward printing facilities, I've taken to writing to MS Wordpad. (I build up a report in a richtextbox, save it to an rtf file, and open it in word pad using Shell.) However, to adjust things like margins, page-orientation, etc., I need to 'sendkeys' to wordpad. I'd much prefer to address these properties more directly if I could.

Anyone know how I'd identify any exposed properties of WordPad (or any other MS application) and set them in program code?

What I'm looking for is something roughly like this:

dim WPh = Shell("Wordpad.exe x.rtf") '== Load file 'x'; may need DoEvents
WPh.MarginLeft = 0.70 '== Set left margin
WPh.Orientation = 1 '== assume 0/1= Portrait/Landscape
WPh.FileMenu.PrintPreview '== whatever ...

I'm grateful for some help.

S
J. S. Schiavo
Missouri Southern State University
Joplin, MO

Comments

  • clanguageclanguage Member Posts: 10
    : Since VB2005 has such awkward printing facilities, I've taken to
    : writing to MS Wordpad. (I build up a report in a richtextbox, save
    : it to an rtf file, and open it in word pad using Shell.) However,
    : to adjust things like margins, page-orientation, etc., I need to
    : 'sendkeys' to wordpad. I'd much prefer to address these properties
    : more directly if I could.
    :
    : Anyone know how I'd identify any exposed properties of WordPad (or
    : any other MS application) and set them in program code?
    :
    : What I'm looking for is something roughly like this:
    :
    : dim WPh = Shell("Wordpad.exe x.rtf") '== Load file 'x'; may need
    : DoEvents
    : WPh.MarginLeft = 0.70 '== Set left margin
    : WPh.Orientation = 1 '== assume 0/1=
    : Portrait/Landscape
    : WPh.FileMenu.PrintPreview '== whatever ...
    :
    : I'm grateful for some help.
    :
    : S
    : J. S. Schiavo
    : Missouri Southern State University
    : Joplin, MO
    Hello JS,
    I have dealt with RTF before and found out the hard way about all the exceptions where a tab, a font size, a bullet and so on interfered with the printing. Wouldn't you be better off with the equivalent of the printform for vb 6. There are many examples on the web if you google (printform vb.net). Here is one example but there are many more.[link=http://www.knowdotnet.com/articles/printform.html][/link]
Sign In or Register to comment.