How to simulate a user pressing escape using the Excel COM interface?
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开发者_StackOverflow中文版):
- 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.
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.
精彩评论