Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello
I work on a com dll that is called from vba and manipulates a workbook. When catching the Workbook.SheetActivate event Excel passes the IDispatch interface of the activated sheet. I then try to compare it to a previously stored _Worksheet interface after querying it for IDispatch. However this never succeeds. One thing I cannot understand is that if I first query the passed IDispatch for the _Worksheet interface everything works as expected. The IDispatch interface is different from the original one passed to the event handler. void EventHandler::OnSheetActivate(IDispatchPtr sheet) { // IDispatchPtr does automatic QueryInterface Excel::_WorksheetPtr ws = sheet; // ws is different from sheet sheet = ws; // sheet is equal to ws and different from initial value ??? // now compare sheet to stored pointer // compare succeeds // if the conversion stuff above is omitted I never find a match for the stored pointer // Note: sheet could also be chart, code to handle this case is not included for brevity } Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Worksheet_change event handler error | Excel Discussion (Misc queries) | |||
What code do I use to attach event handler that will open my user. | Excel Worksheet Functions | |||
Cell Event Handler | Excel Programming | |||
Re : Excel event handler Worksheet_SelectionChange | Excel Programming | |||
Re : Excel event handler Worksheet_SelectionChange | Excel Programming |