tags:

views:

7

answers:

1

I'm working on an Excel add-in and I'm using the Excel COM interface to do automate some testing. So I'll do something like (all through calls to the Excel COM interface):

  • Create a new Excel instance
  • Load my XLL add-in
  • Create a workbook
  • Set some worksheet formulae
  • Check that I get the expected results

Now I want to test that my add-in is correctly responding to user cancel requests, i.e. when the user presses escape while a function is calculating the function should abort.

How can I simulate a user pressing escape using the Excel COM interface?

I'm using Python to write my tests, but I don't think that's relevant.

A: 

If you don't mind using DDE, that would solve your problem. Another approach is to just write an xll to do it. http://kalx.net/xll is a libray that makes it easy to do this.

Keith A. Lewis
Thanks Keith. The library you mentioned looks interesting, I'll be taking a closer look at that. But it's not obvious how I could use that to trigger a user abort/escape event? I don't mind using DDE (or any other approach).
Andy