Click here to Skip to main content
15,887,214 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Cell change event in Excel Pin
Stuart Dootson25-Sep-09 4:03
professionalStuart Dootson25-Sep-09 4:03 
GeneralRe: Cell change event in Excel Pin
NarVish29-Sep-09 19:45
NarVish29-Sep-09 19:45 
GeneralRe: Cell change event in Excel Pin
NarVish30-Sep-09 18:29
NarVish30-Sep-09 18:29 
GeneralRe: Cell change event in Excel Pin
NarVish15-Oct-09 1:38
NarVish15-Oct-09 1:38 
GeneralRe: Cell change event in Excel Pin
Stuart Dootson15-Oct-09 2:26
professionalStuart Dootson15-Oct-09 2:26 
GeneralRe: Cell change event in Excel Pin
NarVish15-Oct-09 2:43
NarVish15-Oct-09 2:43 
GeneralRe: Cell change event in Excel Pin
NarVish15-Oct-09 19:29
NarVish15-Oct-09 19:29 
GeneralRe: Cell change event in Excel Pin
NarVish18-Oct-09 22:13
NarVish18-Oct-09 22:13 
In my class, I have two classes ExcelAppEventHandler and ExcelBookEventHandler
AppHandler contains Sheetchange,WorkbookNewSheet and NewWorkbook events
BookHandler contains SheetCalculate event.
When I create a new worksheet, workbooknewsheet event occurs. in the new worksheet if I add some value, SheetChange event gets fired. Same way SheetCalculate should also be fired whenever calculations happend in the new sheet. classes are give below.
1. ExcelBookEventHandler bookHandler(done,xl);
2. bookHandler.DispEventAdvise(book);
1 and 2 statements are not working to call SheetCalculate event. Please let me know how to call SheetCalculate event from workbooknewsheet event.


class ExcelAppEventHandler : public IDispEventSimpleImpl<1, ExcelAppEventHandler, &__uuidof(Excel::AppEvents)>
{
public:
ExcelAppEventHandler(bool& doneFlag) : done_(doneFlag)
{
done_ = false;
}
BEGIN_SINK_MAP(ExcelAppEventHandler)
SINK_ENTRY_INFO(1, __uuidof(Excel::AppEvents), 0x0000061c, &ExcelAppEventHandler::SheetChange, &SheetChangeInfo)
SINK_ENTRY_INFO(1, __uuidof(Excel::AppEvents), 0x00000625, &ExcelAppEventHandler::WorkbookNewSheet, &WorkbookNewSheetInfo)
SINK_ENTRY_INFO(1, __uuidof(Excel::AppEvents), 0x0000061d, &ExcelAppEventHandler::NewWorkbook, &NewWorkbookInfo)
END_SINK_MAP()

void _stdcall SheetChange(IDispatch *iDispatch, struct Excel::Range *target)
{
cout<<"Inside Sheet Change"<< endl;
}
void _stdcall NewWorkbook(Excel::_Workbook *book)
{
ExcelBookEventHandler bookHandler(done,xl);
bookHandler.DispEventAdvise(book);
}
void _stdcall WorkbookNewSheet(Excel::_Workbook *book, IDispatch *sh)
{
ExcelBookEventHandler bookHandler(done,xl);
bookHandler.DispEventAdvise(book);
}
}

class ExcelBookEventHandler : public IDispEventSimpleImpl<1, ExcelBookEventHandler, &__uuidof(Excel::WorkbookEvents)>
{
public:
ExcelBookEventHandler(bool& doneFlag,Excel::_ApplicationPtr xlApp) : done_(doneFlag),xlapPtr_(xlApp)
{
done_ = false;
}

BEGIN_SINK_MAP(ExcelBookEventHandler)
SINK_ENTRY_INFO(1, __uuidof(Excel::WorkbookEvents), 0x0000061b, &ExcelBookEventHandler::SheetCalculate, &SheetCalculateInfo)
END_SINK_MAP()

void _stdcall SheetCalculate(IDispatch *pDisp)
{
cout<< "Inside SheetCalculate";
}
}
GeneralRe: Cell change event in Excel Pin
Stuart Dootson19-Oct-09 0:25
professionalStuart Dootson19-Oct-09 0:25 
GeneralRe: Cell change event in Excel Pin
NarVish19-Oct-09 0:54
NarVish19-Oct-09 0:54 
GeneralRe: Cell change event in Excel Pin
Stuart Dootson19-Oct-09 1:09
professionalStuart Dootson19-Oct-09 1:09 
Questioninterfacing google earth with c++/MFC app Pin
brian scott21-Sep-09 0:20
brian scott21-Sep-09 0:20 
QuestionWriting unicode to file Pin
yeah100021-Sep-09 0:12
yeah100021-Sep-09 0:12 
AnswerRe: Writing unicode to file Pin
Nuri Ismail21-Sep-09 0:19
Nuri Ismail21-Sep-09 0:19 
GeneralRe: Writing unicode to file Pin
yeah100021-Sep-09 0:42
yeah100021-Sep-09 0:42 
AnswerRe: Writing unicode to file Pin
Naveen21-Sep-09 1:12
Naveen21-Sep-09 1:12 
GeneralRe: Writing unicode to file Pin
yeah100021-Sep-09 1:56
yeah100021-Sep-09 1:56 
GeneralRe: Writing unicode to file Pin
Naveen21-Sep-09 2:27
Naveen21-Sep-09 2:27 
AnswerRe: Writing unicode to file Pin
David Crow21-Sep-09 2:15
David Crow21-Sep-09 2:15 
GeneralRe: Writing unicode to file Pin
yeah100021-Sep-09 2:30
yeah100021-Sep-09 2:30 
GeneralRe: Writing unicode to file Pin
David Crow21-Sep-09 2:35
David Crow21-Sep-09 2:35 
GeneralRe: Writing unicode to file Pin
yeah100021-Sep-09 2:43
yeah100021-Sep-09 2:43 
GeneralRe: Writing unicode to file Pin
David Crow21-Sep-09 3:20
David Crow21-Sep-09 3:20 
QuestionCreate shortcut Pin
gdctld20-Sep-09 23:46
gdctld20-Sep-09 23:46 
AnswerRe: Create shortcut Pin
CPallini21-Sep-09 0:11
mveCPallini21-Sep-09 0:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.