GP Fault Using OLE Automation to Control Word 6.0Last reviewed: February 6, 1998Article ID: Q114390 |
6.00
WINDOWS
The information in this article applies to:
SYMPTOMSIf 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.
STATUSMicrosoft 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 INFORMATIONOLE 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 SubThe 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:
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |