Results 1 to 9 of 9
  1. #1
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Hijacking (VBA/Word/2003)

    I want to gather statistics on document changes as they pass through a given process. To Achieve this I intend to capture statistics each time a file is opened, closed or Saved As.

    My initial thought was to hijack the commands; BUT while I can hijack File | Close, my hijacking code is ignored by <Ctrl + F4> as well as the Closing "x". Curiously, hijacking the File | SaveAs command works with the F12 key.

    Is there any way to hijack the controls which are not invoked through the Menu Bar?

    TIA
    Regards
    Don

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Hijacking (VBA/Word/2003)

    This is rather a mess: the menu option executes FileClose, while Ctrl+F4 executes DocClose. Instead of using these two, you might create an AutoClose macro in your Normal.dot. This will be executed whenever a document is closed, regardless of the method used.

  3. #3
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Hijacking (VBA/Word/2003)

    Hans

    You add emphasis to the title "Mentor" .

    Thank you.
    Regards
    Don

  4. #4
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hijacking (VBA/Word/2003)

    Hans is right of course, but just in case you want to know anyway:
    DocClose catches the document close button (x), Ctrl+W and Ctrl+F4
    FileClose catches the menu-item File | Close
    FileExit catches application close button (X), the menu-item File | Exit and Alt+F4 (and closes Word too of course)

  5. #5
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hijacking (VBA/Word/2003)

    > gather statistics on document changes as they pass through a given process.
    I seem to have managed to capture save/saveas/close events for purposes of my MRUse utility. I maintain a file of selected positions to take the user to the selection next time the file is opened. This seesm to be working too.

    That leads me to believe that statistics is easy for save/close/saveas, including shutting down Word. In 200/2002/2003, Word/Excel too.
    Shall we talk?

  6. #6
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Hijacking (VBA/Word/2003)

    Thank you Jan
    Regards
    Don

  7. #7
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Hijacking (VBA/Word/2003)

    Hi Chris
    I will be placing some supervisory code in the Normal template of a number of users. This supervisory code will run the stats gathering code which resides in an add-in, This way I will only need to visit the users machines once (I'm not about to suggest that they disable the virus protection, or reduce the Office security settings even temporarily), and upgrades to the stats gathering code can be implemented automatically.
    I intend to store the data in a csv file and analyse it with Excel.
    Since I will be collecting a lot of unnecessary data, I am not yet firm on how I will keep the data repository from swelling unnecessarily; but I don't foresee any insurmountable problems.
    Regards
    Don

  8. #8
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hijacking (VBA/Word/2003)

    ER, right, but what I meant (when I replied in too much of a hurry to make myself clear) was to ask where you were having problems.

    Are you now able to hijack all the save/saveas/close events?

  9. #9
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Hijacking (VBA/Word/2003)

    Thanks for the interest Chris. With the support of the Lounge, in this instance I've got the hijacking aced.
    Regards
    Don

Posting Permissions

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