Results 1 to 3 of 3

Thread: Word X

  1. #1
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Word X

    What event is fired when a user clicks the Close Button (upper right X)in Word. I want to trap that.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Word X

    It's the Quit event of the Application object. For those of us learning this as we go, you intercept it like this:

    (1) Create a class module named, for example, evtClass, and paste this into it:

    Public WithEvents wdApp As Word.Application
    Private Sub wdApp_Quit()
    MsgBox "I am quitting!!!"
    End Sub

    (2) Add this to a regular module:

    Private wdEvts As New evtClass
    Public Sub Autoexec()
    'set hook for events
    Set wdEvts.wdApp = Word.Application
    End Sub

    If you already have an Autoexec macro, this can slide right in there. Probably there's a more elegant way to make sure this line (Set wdEvts.wdApp = Word.Application) runs at start-up, but I don't know what it is.

  3. #3
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word X

    Application events. I thought so. Thanks for confirming this and for the code.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •