J
j23
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);
?????????
}
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);
?????????
}