Alternative to Excel RefEdit control that can be used outside of VBA

The RefEdit control included with VBA is a bit erroneous, but it is good for placing 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 in a custom VBA format ( Microsoft claims this , and my tests confirm this too). I am doing an Excel add-in using Delphi and I am looking for an alternative for the RefEdit control .

Excel.Application.InputBox Type:=8 is one of the alternative ways to select a range of cells, but it is not very user friendly when you need people to select multiple ranges of cells in one form. The best real alternative that I have at the moment is to call a VBA form from my Delphi add-in, but this is far from ideal.

Ideally, I could make a replacement for RefEdit, which I can use in Delphi form. If it is, it is not easy to find (I was looking pretty hard, and I could not find a RefEdit replacement for Delphi, VB6, or .NET).

In the event of a failed replacement, I can try to combine my own alternative, but I suspect that it would be difficult, if not impossible, to create one that works the same as RefEdit. RefEdit allows you to “select” cells without actually selecting them: it uses marching ants around your selected cells instead of selecting them and changing Excel.Application.Selection . I do not know how to do this by manipulating the Excel object model through VBA, Delphi, etc.

Any hints, tricks, hacks or, if I'm really lucky, pointers to replacing a RefEdit replacement would be most welcome.

+4
source share
2 answers

I found this replacement for RefEdit control while looking for workarounds for RefEdit errors. Outside control was not an option for me at the time, but it could help you.

+1
source

Not sure about your question: did you try to import RefEdit into Delphi?

You can import it as an ActiveX control from RefEdit.dll, and then remove the TRefEdit control in any Delphi form. and you have the same RefEdit as in your VBA applications.

Or is this what you tried and it doesn't work, because RefEdit needs some kind of VBA woodoo ...?

0
source

Source: https://habr.com/ru/post/1276921/


All Articles