Excel automation highlight issue
-
Hi all, I'm automating Excel from within an ActiveX control and I'm wondering if anyone knows how to highlight the contents of a cell. I'm writing a specialised search routine and I have no problem finding the cells I want but when I select them only the perimeter of the cell gets highlighted. I'm after being able to highlight the contents but haven't found what I need in the type library. Recording a macro didn't throw any light on the issue either. Thanks in advance for any ideas.
Cheers Tom Philosophy: The art of never getting beyond the concept of life. Religion: Morality taking credit for the work of luck.
-
Hi all, I'm automating Excel from within an ActiveX control and I'm wondering if anyone knows how to highlight the contents of a cell. I'm writing a specialised search routine and I have no problem finding the cells I want but when I select them only the perimeter of the cell gets highlighted. I'm after being able to highlight the contents but haven't found what I need in the type library. Recording a macro didn't throw any light on the issue either. Thanks in advance for any ideas.
Cheers Tom Philosophy: The art of never getting beyond the concept of life. Religion: Morality taking credit for the work of luck.
there's some code following from a MS MFC example : Look at excelApp.GetRange(COleVariant("A1"),COleVariant("C6")).Select(); does that help ? 'g' #include "excel8.h" // ... OleVariant covTrue((short)TRUE), covFalse((short)FALSE), covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR); _Application excelApp; if(!excelApp.CreateDispatch("Excel.Application")) { // error handling } excelApp.GetWorkbooks().Add(covOptional); excelApp.GetRange(COleVariant("A1"),COleVariant("C6")).Select(); excelApp.GetActiveCell().SetFormula("Hello World!"); excelApp.SetVisible(TRUE);
-
there's some code following from a MS MFC example : Look at excelApp.GetRange(COleVariant("A1"),COleVariant("C6")).Select(); does that help ? 'g' #include "excel8.h" // ... OleVariant covTrue((short)TRUE), covFalse((short)FALSE), covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR); _Application excelApp; if(!excelApp.CreateDispatch("Excel.Application")) { // error handling } excelApp.GetWorkbooks().Add(covOptional); excelApp.GetRange(COleVariant("A1"),COleVariant("C6")).Select(); excelApp.GetActiveCell().SetFormula("Hello World!"); excelApp.SetVisible(TRUE);
Thanks for the response. Adding text as you have done seems to change it somewhat. Unfortunately, I'm dealing with read only files and as such I'm only trying to highlight what's already present. The call to Select() doesn't highlight the content, only the outline of the cell :( Thanks though
Cheers Tom Philosophy: The art of never getting beyond the concept of life. Religion: Morality taking credit for the work of luck.