Microsoft KB Archive/259940

= BUG: Word 2000 Does Not Quit After Keybindings.ClearAll is Called =

Article ID: 259940

Article Last Modified on 1/27/2007

-

APPLIES TO


 * Microsoft Word 2000 Service Pack 1

-



This article was previously published under Q259940



SYMPTOMS
Microsoft Word does not quit after you call the ClearAll method of the Keybindings collection object.



CAUSE
This problem occurs when you call the ClearAll method and there are no documents open in Word.



RESOLUTION
To work around this problem, make certain that there is at least one document open in Word before you call the ClearAll method. If necessary, you can close the open document after ClearAll runs. This workaround is illustrated in the &quot;More Information&quot; section of this article.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This problem was corrected in Microsoft Word 2002.



Steps to Reproduce Behavior
 Start a new Standard EXE project in Visual Basic. Add a button to the default form, Form1.  Add the following code to the Click event of the button: Private Sub Command1_Click

'Start Microsoft Word and make it visible Dim oWord As Object Set oWord = CreateObject(&quot;Word.application&quot;) oWord.Visible = True

'Clear all key bindings oWord.Keybindings.ClearAll

'Quit Word oWord.Quit False Set oWord = Nothing

End Sub  Press the F5 key to run the program and click the button on Form1.

Results: Word is started and made visible but it does not quit as expected. Instead, Word appears to hang and does not accept any user input. You must use the Windows Task Manager to shut down Word.

Workaround
To workaround this problem, leave at least one document open prior to quitting Word. To implement this workaround in the previous sample, replace the code in Command1_Click with the following: 'Start Microsoft Word and make it visible Dim oWord As Object Set oWord = CreateObject(&quot;Word.application&quot;) oWord.Visible = True

'Clear all key bindings. Before calling Keybindings.ClearAll, create 'a new document and then close it after Keybindings.ClearAll is called Dim oDoc As Object Set oDoc = oWord.Documents.Add oWord.Keybindings.ClearAll oDoc.Close False

'Quit Word oWord.Quit False Set oWord = Nothing

Additional query words: key bindings winword task list tasklist getobject createobject

Keywords: kbautomation kbbug kbpending KB259940

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.