I want to force the focus onto a particular cell, which I have a reference for via XlCall.Excel(XlCall.xlfCaller). I know how to do this in VSTO, but is there a way to do it with ExcelDNA?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One way would be to use the COM Automation interface, as you would from VBA or VSTO. Just be sure to use the
Applicationobject you get fromExcelDnaUtil.Applicationas your root. To convert from theExcelReferencethat you received fromxlfCallerto a COMRangeobject, you might try (this is the VB.NET version):If you want to stick with the C API, you’d first have to select the right sheet, then the actual cell. So you might have:
You won’t be able to change the selection in a worksheet function, so I presume you are calling this from a macro or ribbon handler.