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!

Using OLE container as a WordPad?

Status
Not open for further replies.

AndyGroom

Programmer
May 23, 2001
972
0
0
GB
If I create an OLE object and choose WordPad document from the list of defaults, when I run the project I just get WordPad as a slit at the top of the screen and I can't seem to make it any larger. Am I missing something obvious?

- Andy
___________________________________________________________________
If a man speaks in a forest and there are no women around to hear him - will he still be wrong?
 
OLE Embedding has always been a bit problematic and even frustrating for users. In most cases they have to click on the embedded thingy in order to open it.

If you need something fancier than just a RichTextBox but not as fancy as WordPad you might look at:

RTBCompose RTF Editor UserControl

It adds a button bar for common RTF editing tasks and offers methods for loading or saving to files or Strings. It can be handy for database programs where the user needs a little more support for editing RTF Memo fields and such than just a RichTextBox provides.

The demo Project wraps it in a Form with load/save File menu items.

Just a suggestion. You can probably find other similar things out in the wilds of the Web as well.
 
Assuming you really want to use OLE with WordPad to do this...

Have you tried playing with the control's SizeMode property? SizeMode = vbOLESizeStretch might be closer to what you want.
 
On second thought (actually trying it) that won't work either. It looks ok while the embedded object is active (while editing the text). But then when you deactivate it (Esc key) you have a scaled up representation of the content.
 
Also see How To embed and automate Office documents with Visual Basic

The size and position of the hatched border that displays when the container is made in-place active is determined by the size of the object and the options selected for the OLE control. This border is displayed to mark the boundaries of the editing window. The boundaries of the editing window often do not match the boundaries of the OLE container itself; this behavior is normal for an OLE object. The editing window cannot be programmatically altered from Visual Basic.

This is part of what makes it difficult to make much serious use of the OLE control.

For a long time people tried using the DSOFramer control (an unsupported OCX from Microsoft) as an alternative. However the download has been pulled as well as KB 311765 that introduced it. DSOFramer had its own share of problems.
 
Thanks for the replies. I'll investigate further but I suspect I won't be able to do what I'd hoped.

- Andy
___________________________________________________________________
If a man speaks in a forest and there are no women around to hear him - will he still be wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top