GP Fault Using OLE Automation to Control Word 6.0

Last reviewed: February 6, 1998
Article ID: Q114390
6.00 WINDOWS

The information in this article applies to:

  • Microsoft Word for Windows, version 6.0

SYMPTOMS

If you use OLE Automation to control Word 6.0 for Windows from another application or programming language--such as Microsoft Excel and Visual Basic for Applications or Visual Basic--a general protection (GP) fault may occur in Word. The GP fault occurs when the programming code commands Word to perform repeated commands, such as a command that exists within a For/Next or While/Wend loop.

STATUS

Microsoft has confirmed this to be a problem in Word 6.0 for Windows. This problem was corrected in Word 6.0a and later for Windows.

MORE INFORMATION

OLE Automation is a way for applications and programs to control another application and use its functionality. Similar to dynamic data exchange (DDE), OLE Automation allows a programmer to gain access to another application's objects that have been "exposed" to OLE Automation. In the case of Word 6.0 for Windows, the WordBasic object has been exposed to OLE Automation, meaning that another application that uses OLE Automation can gain access to Word's functionality through the WordBasic macro language.

Note that Word 6.0 for Windows does not support using OLE Automation from within WordBasic. To control other applications from within WordBasic, use the WordBasic DDE commands.

Here is a short example of an OLE Automation routine that might be used in Visual Basic or Visual Basic for Applications program to insert the word "Hello" ten times down the page in the active Word 6.0 document:

Sub Repeat()
  Dim WordObj As Object
  Set WordObj = CreateObject("Word.Basic")
  For x = 1 To 10
    WordObj.Insert "Hello"
    WordObj.InsertPara
  Next
End Sub

The most current version of Word 6.x for Windows is Word 6.0c. To obtain this update, contact the Microsoft Order Desk at (800) 360-7561 and request the Word 6.0c update. If you are outside the United States, contact the Microsoft subsidiary for your area. To locate your subsidiary, see the Microsoft World Wide Offices Web page at:

  http://www.microsoft.com/worldwide/default.htm

REFERENCES

"Microsoft Excel Visual Basic User's Guide," version 5.0, Chapter 10, "Controlling and Communication with Other Applications," pages 189-216


KBCategory:
KBSubCategory:
Additional reference words: 6.00 gpf winword custsales word6
Keywords : kbole
Version : 6.00
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 6, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.