The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

How to implement this?


I am developing an XLL-style data analysis Excel add-in (using the Excel C API). The add-in contains a command which processes spreadsheet data selected by a user.

The question is whether it's possible to implement the interactive cell range selection like the one available on the Step 2 of the Diagram Wizard (when you insert a new diagram).

I realize that the command has to display a modeless window which communicates with the spreadsheet and updates when the cell selection is changed. The problem is that the Excel C API doesn't appear to provide an appropriate event (something like xlcOnChangeSelection). So should I use a system timer and constantly query Excel for the current cell selection?

I've got a book on Excel Add-In development by Stephen Dalton, but it doesn't shed any light on the problem.

Your help is appreciated.
Confused Excel Add-In Developer
Saturday, September 08, 2007
Donno anything about Excel dev specifically, but if the user's moving their mouse about quite a bit, then you'd be better off using a timer.  Less data to process that'd just get changed a few milliseconds later, anyway.

Just make sure your timer isn't too fast (the time to process the selection is more than the timer interval, leading to a lag) or too slow (unresponsive U/I, and/or using an older value for the selection).
Lally Singh Send private email
Saturday, September 08, 2007
I've been able to implement the desired functionality using the DIALOG.BOX macro command in Excel.  If you use a "Reference edit box" (item number = 10) in a custom dialog box, it works exactly as I described - in a standard Excel way. The dialog even automatically reduces while you change the selection. It also adds a little button at the right of the reference edit box so you can manually reduce/expand the window. 

I imagine using Excel() with xlfDialogBox from C should work in the same way. So no need to use VBA.

Hope this helps someone working on the same problem.
Confused Excel Add-In Developer
Monday, September 10, 2007
I've read a lot of complaints about RefEdit being buggy. VBA developers commonly use the alternate Application.InputBox with Type:=8, where "Application" refers to the Excel Application. I don't know the syntax to call that from an XLL, but it's worth looking into as an alternate.

Also, if you post the question on the Google Group linked below, there's a Microsoft rep who fields questions. He'll probably be able to give a better answer.
Nick Hebb Send private email
Wednesday, September 12, 2007
Nick, thanks for letting me know about that Group.

Unfortunately Application.InputBox won't work for me as I need to have some additional controls on the same form.

I've managed to use xlfDialogBox in my XLL. Seems to work well, at least under Excel XP.
Excel Add-In Developer
Wednesday, September 12, 2007

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz