The RefEdit control that comes as part of VBA is a little buggy, but it's good for putting on a form when you want people to specify one or more ranges of cells (i.e. Excel.Range
objects).
The main problem is that you can only use the RefEdit control on a VBA UserForm (Microsoft states this, and my tests confirm it too). I'm making an Excel add-in using Delphi, and I'm looking for an alternative to the RefEdit control.
Excel.Application.InputBox Type:=8
is one alternative way of selecting a range of cells, but it's not very user-friendly when you need people to select multiple ranges of cells on a single form. The best real alternative I have at the moment is to call a VBA form from my Delphi add-in, but that's far from ideal.
So ideally I could do with a drop-in replacement for RefEdit - one that I can use on a Delphi form. If there is one, it's not easy to find (I've been searching pretty hard, and I've not been able to find a drop-in RefEdit replacement for Delphi, VB6, or .NET).
Failing a drop-in replacement I might try cobbling together my own alternative, but I suspect it would be difficult if not impossible to make one that works as well as RefEdit. RefEdit lets you "select" cells without actually selecting them: it uses marching ants around the cells that you choose instead of highlighting them and changing the Excel.Application.Selection
. I don't know of a way to do that by manipulating the Excel object model through VBA, Delphi, or whatever.
Any tips, tricks, hacks, or, if I'm really lucky, pointers to drop-in RefEdit replacements would be most welcome.