Excel Workbook Close Event__ Documentation Proof needed.

N

Naveen.Kasha

Hi All,

I need a documentation proof for the following observation i have
made(presuming my observations are correct :) )

I have written a addin for Microsoft Excel.
This addin handles the CLOSE event from the Excel.
But now , I have a Macro in an Excel sheet which is also listening for
the close event.(the macro is as below)

Private Sub Workbook_BeforeClose(Cancel As Boolean)
If MsgBox("Confirm exit", vbYesNo) = vbNo Then
Cancel = True
End If
End Sub


And in the Addin , i am using the Cancel parameter as below.

OnWorkbookBeforeClose(IDispatch* pWorkbook, VARIANT_BOOL* pbCancel)
{

//So here pbCancel value is depending on what is clicked in that
message box --
// As it is seen Message box has two buttons "Yes" and "No"
// If "No" button is clicked , the Cancel parameter value we get is
"True"
// If "Yes" button is clicked, the addin does what is intend it to do.
(i:e it closes the Excel)
}


As it is understood
This macro pops up a message box and can alter the "cancel" depending
on what is clicked.
And in the Addin,
what i get now is the edited value of the "Cancel" parameter if "NO"
button is clicked.

So, what i am assuming is, THE EVENT FIRST GOES TO THE MACRO AND ONLY
THEN COMES TO MY ADDIN.

So, is my assumption Correct, if so , can i have some Documentation
proof for the same(i:e - The control goes to the macro first and then
will be sent to the Addin's (if any))

So, has any one come across the same situation.
It would be of great help if you reply me on this.
Thanks in Advance.
Naveen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top