How can I programmatically know if the Excel Formula bar has the focus RRS feed

  • Question

  • I have to create a Active-X controls just next to the selected cell of the excel workbook using VSTO C# but the problem is if the formula bar has the focus, my function does not work. 

    To solve this issue, just before creating my control I start doing SendKeys.SendWait("{ESC}");

    This has solved the problem but with the new issue.

    I can add the same Active-X control, using VB macro, which eventually call my C# code but when SendKeys.SendWait("{ESC}"); is called in this case, it focus the previously selected application.  

    Is there a way, I can programmatically know if the Formula bar has the focus or if I can remove focus from formula bar and set it to selected cell? 


    M Sharma, Deloitte, USA

    Thursday, May 16, 2013 7:59 PM