BUG: Embedded Word Document Scrolls to Top While Editing In-Place (268278)



The information in this article applies to:

  • Microsoft Office Word 2003
  • Microsoft Word 2002
  • Microsoft Word 2000
  • Microsoft Word 97 for Windows
  • Microsoft Visual Basic Professional Edition for Windows 6.0

This article was previously published under Q268278

SYMPTOMS

When a Microsoft Word document that is embedded in an OLE Container Control is activated in-place, the document's window may automatically scroll to the beginning of the document while editing. This problem occurs when the document has scrolled beyond the region that can be viewed on the window.

CAUSE

The problem is due to the auto-resize behavior of Word OLE objects. When an embedded Word document is activated in-place, Word automatically attempts to resize the object so that the entire content of the document is displayed. As more text is added to the document, the OLE object is supposed to "grow" to allow the text to become visible in the container. This is the behavior you see when Word is embedded in a Microsoft Excel worksheet or a Microsoft PowerPoint slide.

However, if Word attempts to resize while the document is hosted in an OLE Container Control, the resize fails and the document is scrolled to the top instead.

RESOLUTION

There is no resolution to this problem when in-place editing a Word document in a container that does not support dynamic resizing. There are, however, alternative ways to edit embedded Word documents:
  • Open the document in a separate Word window rather than editing the document in-place. This allows you full access to all the commands and features of Word.

    -or-

  • Use the Web Browser control for hosting a Word document on a form. ActiveX Documents are not limited in size and scope as OLE objects are, allowing you to scroll and perform page layout while in-place. For additional information, click the article number on this topic below to view the article on this topic in the Microsoft Knowledge Base:

    243058 HOWTO: Use the WebBrowser Control to Open an Office Document

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Start a new Standard EXE project in Visual Basic. Form1 is created by default.
  2. Add an OLE Control to Form1.
  3. Choose to insert a new Microsoft Word Document when prompted.
  4. Press the F5 key to run the program.
  5. Double-click the OLE Control to in-place activate the Word document for editing.
  6. Type multiple lines of text in the Word document until the document scrolls enough that the first lines of text do not appear in the window, and then wait for a few seconds.

    Results: The document window automatically scrolls to the top.

REFERENCES

For similar reasons, scrollbars do not appear when working with a Word document opened in-place as an OLE object. If the scrollbars are displayed using code, they disappear when Word requests a resize and jumps to the top. For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

190520 BUG: ScrollBars Disappear on Mouse Move in OLE Container

The FoxPro OLE Container has a setting that allows the container to auto-resize, and thereby avoid the problem. For additional information on this issue in FoxPro, click the article number below to view the article in the Microsoft Knowledge Base:

265104 PRB: Document Jumps to Top When You Edit With an OleBoundControl


Modification Type:MajorLast Reviewed:3/23/2006
Keywords:kbbug kbContainer kbInplaceAct kbnofix kbProgramming kbWebBrowser KB268278 kbAudDeveloper