August 12th, 2003, 07:08 AM
Several Microsoft Excel OLE/COM problems
seems Excel doesn't like me nor what I'm trying to do with it...
I'm coding some Office automation library here at work (quality assurance dept./test automation). That's to find any controls embedded in Excel worksheets, like buttons, checkboxes or listboxes. I can already find them, tell some properties of it, get checkbox state, get textbox contents aso. But I have some major problems still left with this, I'm not able to solve:
* Excel has two different types of controls: its own ones and ActiveX (fm20.dll). Excel's self-drawn controls are by far less powerful, but as users may make use of them, we must be able to handle this. Now my 1st question on that is: How can I determine which rows are currently selected in a listbox? (I mean multi-select lists.) For ActiveX controls, there's a 'bool GetSelected(int)' function, no problem. But I just can't find something similar for the other type.
2nd question: Is there a way to read out the caption of command buttons, checkboxes aso? I can read the VBA name and the alternative Web description. But no way to get the caption that's actually displayed... Anyone?
* In order to convert the document-relative coordinates over to screen/window positions, I believe I need to do some calculation over column widths, scroll positions and pane/fixed ranges. I have created a VBA program directly in Excel that does it for me, but I can't translate it into VC++, because I can't find an equivalent to the 'Worksheet.Columns(...)' array. In VBA I can access i.e. ActiveSheet.Columns(1).Width to get the 1st column's width. In VC++ (with automatically imported wrapper classes), I only see the 'LPDISPATCH Worksheet.GetColumns()' function. But no class to handle this dispatch interface with.
* And one minor thing: Has anyone seen an Excel textbox control yet or was able to create one? I mean the textbox button from the 'Form' toolbar which is constantly disabled on my machine... But if nobody can use such a control, I don't need to handle it :)
That's it for now... I'd be really thankful if anyone could help me out with this.
btw, using Office 2000/XP, Windows 2000/XP, Visual Studio 6.