A
Arthur Fiedler
I'm using c# and im developing a com addin that needs the ability to cancel save's in word,excel,powerpoint, and visio... the problem is so far i tired with word and excel both programs when u set cancel = true in the even it doesnt cancel it!! ever! It does fire the event fine... I've tried various things including...
// add event
((Word.ApplicationEvents2_Event)wordApp).DocumentBeforeSave += new Word.ApplicationEvents2_DocumentBeforeSaveEventHandler(Word_BeforeSaveDocument);
// event fired
public void Word_BeforeSaveDocument(Word.Document wd, ref bool SaveAsUI, ref bool Cancel)
{
MessageBox.Show("You must first do ... to the document.");
//following doesnt work
Cancel = true;
}
i've also tried just marking the word document as saved and it seems not to try to save it then... but then inside excel i run into the problem where it saves it anyways! even if the .saved = true... i must stop this save event for my addin to work correctly... or i need some form of a workaround... anyone have anyideas?
// add event
((Word.ApplicationEvents2_Event)wordApp).DocumentBeforeSave += new Word.ApplicationEvents2_DocumentBeforeSaveEventHandler(Word_BeforeSaveDocument);
// event fired
public void Word_BeforeSaveDocument(Word.Document wd, ref bool SaveAsUI, ref bool Cancel)
{
MessageBox.Show("You must first do ... to the document.");
//following doesnt work
Cancel = true;
}
i've also tried just marking the word document as saved and it seems not to try to save it then... but then inside excel i run into the problem where it saves it anyways! even if the .saved = true... i must stop this save event for my addin to work correctly... or i need some form of a workaround... anyone have anyideas?