GP Fault Using OLE Automation to Control Word 6.0

ID: Q114390


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

Additional query words: gpf winword custsales word6

Keywords : kbole
Version : WINDOWS:6.0
Platform : WINDOWS
Issue type :


Last Reviewed: December 28, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.