BUG: Word 2000 Does Not Quit After Keybindings.ClearAll is Called (259940)



The information in this article applies to:

  • Microsoft Word 2000, Service Release 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 "More Information" 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.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Start a new Standard EXE project in Visual Basic.
  2. Add a button to the default form, Form1.
  3. 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("Word.application")
        oWord.Visible = True
    
        'Clear all key bindings
        oWord.Keybindings.ClearAll
    
        'Quit Word
        oWord.Quit False
        Set oWord = Nothing
    
    End Sub
    					
  4. 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("Word.application")
    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
				

Modification Type:MajorLast Reviewed:8/27/2002
Keywords:kbAutomation kbbug kbDSupport KB259940