none
DocumentBeforeClose event is now working for me RRS feed

  • Question

  • I'm writing a script to manage the Quit and Save events in Word 2010, some could help me with this piece of code?

    The event word_Quit is working correctly. However the event word_DocumentBeforeClose isn't.

    word = WScript.CreateObject("Word.Application")
    WScript.ConnectObject(word, "word_")
    
    word.visible = true
    bWordVisible = true
    
    while (bWordVisible)
    {
        WScript.Sleep(500)
    }
    
    function word_Quit ()
    {
        bWordVisible = false
        WScript.Echo("You quit Word.")
    }
    
    function word_DocumentBeforeClose ()
    {
        WScript.Echo("You switched documents.")
    } 

    Any help would be appreciated. Thanks in advance.

    Monday, June 25, 2012 4:55 PM

Answers

All replies