WD2000: ApplyListTemplate Method May Cause Invalid Page Fault

ID: Q220559


The information in this article applies to:
  • Microsoft Word 2000


SYMPTOMS

When you run a Visual Basic for Applications macro that uses the ApplyListTemplate method, the following error message may appear:

This program has performed an illegal operation and will be shut down.

If the problem persists, contact the program vendor.
When you click Details, the following message is displayed:
WINWORD caused an invalid page fault in module MSO9.DLL at 015f:308e0522.
NOTE: The actual memory address may vary.


CAUSE

Your macro may contain command lines where the ApplyListTemplate method is encountered after a command line that uses any of the ListLevels properties or methods.


WORKAROUND

Microsoft provides programming examples 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. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Solution Provider or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Solution Providers, please see the following page on the World Wide Web:

http://www.microsoft.com/mcsp/
For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://www.microsoft.com/support/supportnet/refguide/
To work around this problem, do not place an ApplyListTemplate method command line after any command line that uses any of the ListLevels properties or methods.

For example:

INCORRECT:

With lstLvl

' WARNING!  ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! WARNING! 
'
'    RUNNING THIS MACRO WILL CAUSE AN INVALID PAGE FAULT
'    CAUSING WORD AND POSSIBLY YOUR OPERATING SYSTEM TO CRASH.
'
' WARNING!  ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! WARNING!

   .LinkedStyle = "Heading " & 1
   ActiveDocument.Range.ListFormat. _
      ApplyListTemplate lstTmp, , , wdWord9ListBehavior
   .NumberStyle = 1
   .NumberFormat = "%" & 1 & "."
   .NumberPosition = 18
End With 
CORRECT:

With lstLvl
   ActiveDocument.Range.ListFormat. _
      ApplyListTemplate lstTmp, , , wdWord9ListBehavior
   .LinkedStyle = "Heading " & 1
   .NumberStyle = 1
   .NumberFormat = "%" & 1 & "."
   .NumberPosition = 18
End With 


STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.


MORE INFORMATION

For more information about the ApplyListTemplate method, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type "ApplyListTemplate method" in the Office Assistant or the Answer Wizard, and then click Search to view the topic.


For more information about the ListLevels property, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type "ListLevels property" in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

Additional query words: vba

Keywords : kbdta kbwordvba wd2000
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbbug


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