![]() |
Excel events - please help!!!!
How to catch excel events form C++ program? I have no idea?
Here is my code, I can connect to excel, create new workbook, but how to connect my handler to Excel event? HRESULT BeforeSave (VARIANT_BOOL SaveAsUI, VARIANT_BOOL *Cancel) { MessageBox(NULL, "Hello fro beforesave", "zzz", MB_OK); *Cancel = false; return 0; } { _ApplicationPtr pXL; try { pXL.CreateInstance(L"Excel.Application"); pXL-Visible = VARIANT_TRUE; pXL-EnableEvents = true; WorkbooksPtr pBooks = pXL-Workbooks; _WorkbookPtr pBook = pBooks-Add((long)xlWorksheet); ????????? } |
Excel events - please help!!!!
I don't know anything about C++, but this article may get you started:
http://support.microsoft.com/default...83&Product=vcc HOWTO: Trap Events Exposed by Office Applications It has a reference to an article specific to Word, but that should be adaptable to Excel. -- Regards, Tom Ogilvy "j23" wrote in message ... How to catch excel events form C++ program? I have no idea? Here is my code, I can connect to excel, create new workbook, but how to connect my handler to Excel event? HRESULT BeforeSave (VARIANT_BOOL SaveAsUI, VARIANT_BOOL *Cancel) { MessageBox(NULL, "Hello fro beforesave", "zzz", MB_OK); *Cancel = false; return 0; } { _ApplicationPtr pXL; try { pXL.CreateInstance(L"Excel.Application"); pXL-Visible = VARIANT_TRUE; pXL-EnableEvents = true; WorkbooksPtr pBooks = pXL-Workbooks; _WorkbookPtr pBook = pBooks-Add((long)xlWorksheet); ????????? } |
All times are GMT +1. The time now is 03:46 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com