Accessing MS Word document in OLE Container Control 
Author Message
 Accessing MS Word document in OLE Container Control

I need to do 3 things with an MS Word document hosted in an OLE Container
control on a VB form:
1. Allow the user to paste formatted text into it
2. Extract the RTF in the document
3. Restore the RTF in the document whenever the form is displayed.

Here are the problems:
1. When the OLE control is activated, the document is clipped to a narrow
horizontal band delimited by movable "bars" - how can I get the document to
be displayed using the entire OLE control window without making the user
resize it every time?
2. I can extract the RTF into a string via the clipboard, but when I try to
do step #3 above by pasting the RTF into the document, the contents aren't
displayed until the OLE control is activated by double-clicking it.  How do
I refresh the control after pasting the RTF without having to activate it?

Here's the code for step #3:

Clipboard.SetText .Fields("WordInfo"), vbCFRTF
oleWord.CreateEmbed vbNullString, oleWord.Class
With oleWord.object
    .Content.Select
    .Range.Paste
End With
oleWord.Visible = True      ' The control is sometimes hidden
Me.Show vbModal

Thanks in advance for any help.
- Michael



Fri, 25 Jun 2004 11:02:25 GMT  
 Accessing MS Word document in OLE Container Control
Michael,

Have a look at the following:
Q242243 HOWTO: Embed and Automate Office Documents with Visual Basic
http://support.microsoft.com/support/kb/articles/q242/2/43.asp

HTH,
Gerard

Microsoft Office Development with Visual Studio
http://msdn.microsoft.com/library/en-us/dnoffdev/html/vsofficedev.asp

Are you secure? For information about the Microsoft Strategic Technology
Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. ? 2001 Microsoft Corporation. All rights
reserved.
--------------------

| Subject: Accessing MS Word document in OLE Container Control
| Date: Sun, 6 Jan 2002 19:02:25 -0800
| Lines: 33
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

| Newsgroups:
microsoft.public.office.developer.automation,microsoft.public.office.develop
er.vba,microsoft.public.vb.controls,microsoft.public.vb.ole,microsoft.public
vb.ole.automation,microsoft.public.word.vba.customization
| NNTP-Posting-Host: evrtwa1-ar9-4-35-094-233.vz.dsl-gtei.net 4.35.94.233
| Path: cpmsftngxa09!tkmsftngp01!tkmsftngp03
| Xref: cpmsftngxa09 microsoft.public.office.developer.vba:8183
microsoft.public.vb.controls:122698 microsoft.public.vb.ole:17340
microsoft.public.vb.ole.automation:19793
microsoft.public.word.vba.customization:2545
microsoft.public.office.developer.automation:2949
| X-Tomcat-NG: microsoft.public.office.developer.vba
|
| I need to do 3 things with an MS Word document hosted in an OLE Container
| control on a VB form:
| 1. Allow the user to paste formatted text into it
| 2. Extract the RTF in the document
| 3. Restore the RTF in the document whenever the form is displayed.
|
| Here are the problems:
| 1. When the OLE control is activated, the document is clipped to a narrow
| horizontal band delimited by movable "bars" - how can I get the document
to
| be displayed using the entire OLE control window without making the user
| resize it every time?
| 2. I can extract the RTF into a string via the clipboard, but when I try
to
| do step #3 above by pasting the RTF into the document, the contents aren't
| displayed until the OLE control is activated by double-clicking it.  How
do
| I refresh the control after pasting the RTF without having to activate it?
|
| Here's the code for step #3:
|
| Clipboard.SetText .Fields("WordInfo"), vbCFRTF
| oleWord.CreateEmbed vbNullString, oleWord.Class
| With oleWord.object
|     .Content.Select
|     .Range.Paste
| End With
| oleWord.Visible = True      ' The control is sometimes hidden
| Me.Show vbModal
|
|
|
| Thanks in advance for any help.
| - Michael
|
|
|



Sun, 04 Jul 2004 04:19:30 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Accessing MS Word document in OLE Container Control

2. Loading Word document from Access OLE field into OLE container control in VB

3. Loading Word document from Access OLE field into OLE container control in VB

4. Loading Word document from Access OLE field into OLE container control in VB

5. How do you control the location of a Word Document inside an Ole Container control

6. Trap keys pressed to ole container with word document embedded in it on win 95/98

7. Word Document in Ole Container

8. OLE Container/VB6/ADO/MS Access

9. OLE document container control

10. Lightweight OLE Document container control?

11. Replacement for the MS OLE Container Control

12. VB4 OLE Container Control Problem (Print Preview in Word)

 

 
Powered by phpBB® Forum Software