How to Scroll an Embedded Word 6 Document in VB OLELast reviewed: May 17, 1996Article ID: Q147804 |
The information in this article applies to:
SUMMARYWord for Windows version 6.0 does not supply scroll bars that allow an activated document embedded in the Visual Basic OLE container control to be scrolled through. This article describes how to provide buttons that allow the user to scroll through an embedded Word for Windows version 6.0 document that has been activated for visual editing. To scroll through the window, you must call a Word Basic method such as VLine. However, if you call the method from within a scroll-bar event, the code does not work. The problem is that when the scroll bar receives the focus, the Word document object in the OLE control is deactivated. If you try to activate the Word Document object in the scroll-bar event, the insertion point moves to the beginning of the document, causing you to lose the current position in the document. This problem happens with any control that can receive the focus.
MORE INFORMATIONTo work around the problem, use a control that cannot receive the focus (for example, the image-control or the spin button). You can use the image control to simulate a button. When you click it, the focus remains on the OLE container control, and therefore the Word document object stays activated. This allows you to call a Word Basic method such as VLine to allow you to scroll through the window in the click event of the image control.
Example
Notes
|
Additional reference words: vb4win scrollbar
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |