cccoder

Hi,

I had a plugin for Excel written in C++, with an event sink. Another functionality request to add was to validate certain data before printing the workbook. If the data can not be validated correctly, then the print job must be canceled.

The event sink can get the print event correctly in the Invoke() method (inherited from IDispatch), but how can I cancel the print job In VBA, you can set the cancel flag to true in Workbook_BeforePrint subroutine, but there does not seem to have an equivalent in C++.

We are not supposed to use any interop library because of backward compatibilty issue. Some users are running older version of Office.

The question is, how can I cancel the print job from inside the Invoke() function

Thanks in advance

ccccoder




Re: Visual Studio Tools for Office Equivalent of Workbook_BeforePrint in C++ COM interface

Cindy Meister

I'm sorry, but this forum is targeted specifically at the VSTO technology. VSTO does not include C++, nor is Office automation actually an "on-topic" subject. There is a list of venues for Office-related questions outside VSTO in the "Please Read First" message at the top of this forum. I suggest you try the excel.programming newsgroup, to begin with.




Re: Visual Studio Tools for Office Equivalent of Workbook_BeforePrint in C++ COM interface

cccoder

Sorry, just trying to get some help. Been stuck with this problem for 3 days, and there is not a single forum for this question. The office.automation forum said C++ questions should not belong there either.

I kinda feel that people who had developed solution based on COM technologies should drop it all together, there is no venue for help anymore and it is a technology being ignored Sad Unfortunately for us, a company where the big cheese had bought into the MS dream-seller of COM technologies a while back, and invested heavily in that areas.

Anyways, sorry for the inconvenience.








Re: Visual Studio Tools for Office Equivalent of Workbook_BeforePrint in C++ COM interface

Cindy Meister

Still, do try the excel.programming group. Excel does have a special API for C++, so someone there might have an idea for you, or know where to send you.