OFF97: Error Using Help Method with Microsoft Word 97

Last reviewed: June 4, 1997
Article ID: Q161805
97 WINDOWS kbinterop kbusage kbprg kbcode kberrmsg

The information in this article applies to:

  • Microsoft Access 97 for Windows
  • Microsoft Excel 97 for Windows
  • Microsoft PowerPoint 97 for Windows
  • Microsoft Word 97 for Windows

SYMPTOMS

When you run a Visual Basic for Applications macro in any of the programs listed at the beginning of this article, you may receive the following error message:

   This program has performed an illegal operation and will be shut down.
   If the problem persists, contact the program vendor.

If you click Details, you receive the following error message:

   WINWORD caused an invalid page fault in module MSO97.DLL at
   0137:307be411.

CAUSE

This problem will occur if the following conditions are true:

  • Your Visual Basic macro uses OLE Automation to communicate with Microsoft Word 97.

    -and-

  • In the macro, you use the Help method to display help in Microsoft Word 97.

    -and-

  • After displaying Help in Microsoft Word 97, you use the Quit method to close the instance of Microsoft Word 97.

WORKAROUND

To prevent this problem from occurring, use the Assistant object and the Help method together rather than the Help method by itself to display help in Microsoft Word 97. For example:

   Do Use                     Don't Use
   ----------------------     -----------------------------
   WordApp.Assistant.Help     WordApp.Help helptype:=wdHelp

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

In Visual Basic for Applications macros, you can use the CreateObject and GetObject methods of OLE Automation to communicate with and control other programs. For example, a macro in Microsoft Excel 97 can start and control an instance of Microsoft Word 97.

If you use OLE Automation to control an instance of Microsoft Word 97, you may receive an error if you use the Help method to display Help in Microsoft Word 97 and then quit the instance of Microsoft Word 97 without first closing the Help window.

Microsoft provides examples of Visual Basic for Applications procedures for illustration only, without warranty either expressed or implied, including, but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The Visual Basic procedures in this article are provided 'as is' and Microsoft does not guarantee that they can be used in all situations. While Microsoft support engineers can help explain the functionality of a particular macro, they will not modify these examples to provide added functionality, nor will they help you construct macros to meet your specific needs. If you have limited programming experience, you may want to consult one of the Microsoft Solution Providers. Solution Providers offer a wide range of fee-based services, including creating custom macros. For more information about Microsoft Solution Providers, call Microsoft Customer Information Service at (800) 426-9400.

The following sample macro illustrates the steps necessary for the problem to occur:

   Sub Test()
       Dim WordApp As Object

       'Begin using OLE Automation to communicate with Microsoft Word 97.
       Set WordApp = CreateObject("Word.Application")
       WordApp.Visible = True
       AppActivate WordApp.Name

       'Display Help in Microsoft Word 97. Using this line of code will
       'ultimately cause the problem to occur.
       WordApp.Help helptype:=wdHelp

       'Quit Microsoft Word 97. The crash actually occurs here.
       WordApp.Quit
       Set WordApp = Nothing
   End Sub

If you replace the line:

   WordApp.Help helptype:=wdHelp

with the line:

   WordApp.Assistant.Help

the error does not occur.


KBCategory: kbinterop kbusage kbprg kbcode kberrmsg
KBSubcategory: offinterop xlvbainfo offhelp
Additional reference words: 8.00 97 OFF97 XL97 WORD97 ACC97 PPT97
Keywords : offhelp offinterop PgmOthr xlvbainfo kbcode kberrmsg kbinterop kbprg kbusage
Version : 97
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: June 4, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.