Can I programmatically detect when Word is undoing an action? RRS feed

  • Question

  • In my project, I had to use WindowSelectionChange to update the ribbon according the selection in the document. But when the user click the “undo” button and the  program goes through my WindowSelectionChange routine, all the reference to the model commands (which were working perfectly well in the normal “positive” moment) are lost and arise a run time error 6197 ( which description in a loosely translation is "Model's objects command not available in the present event").

    If I could programmatically know when word is performing an undoing action I could force the program to exit my WindowSelectionChange before the error arise.

    Sorry,  because I already formulated this problem in a slightly different way in this post.

    Thanks, Lauro
    Monday, April 9, 2012 7:52 PM

All replies

  • Hi Lauro,

    I have a suggestion:

    catch the error and route it to nothing could solve the problem.

    use key press event to catch Ctrl + Z (to Undo) and skip it to 0 (zero)

    similarly for the menu command also.

    With Regards
    Repath Athyala

    Love the Love that Loves the Love and Hate the Love that Loves the Hate.

    Tuesday, April 10, 2012 12:56 PM