Discussion:
Handling Cancel Event in Save Dialog Box
(too old to reply)
Rita
2006-06-16 13:56:01 UTC
Permalink
Hi
I created a add-in. I should be creating a header on the save of the
document. I binded the save event in the onConnection().Event binded is:
oWord.DocumentBeforeSave += new
Word.ApplicationEvents4_DocumentBeforeSaveEventHandler(oWord_DocumentBeforeSave)

At present i'm creating a header in the oWord_DocumentBeforeSave(). Problem
here is when user clicks on save, save dialog box is prompted. If user clicks
on cancel in the save dialog box even then header is created. I need to
create header only when he saves the document. The code which i have used in
oWord_DocumentBeforeSave() is as follows:

private void oWord_DocumentBeforeSave(Word.Document doc, ref bool SaveAsUI,
ref bool Cancel)
{
SetWordHeaderFooter();
}

Is there any way i can handle Cancel button click event when user clicks on
Cancel in Save dialog box. Any helpon this is highlt appreaciated.

Thanks in Advance
Jezebel
2006-06-17 01:24:17 UTC
Permalink
Nothing you can do in the BeforeSave event to deal with this. The usual
method is to trap the Save command itself.
Post by Rita
Hi
I created a add-in. I should be creating a header on the save of the
oWord.DocumentBeforeSave += new
Word.ApplicationEvents4_DocumentBeforeSaveEventHandler(oWord_DocumentBeforeSave)
At present i'm creating a header in the oWord_DocumentBeforeSave(). Problem
here is when user clicks on save, save dialog box is prompted. If user clicks
on cancel in the save dialog box even then header is created. I need to
create header only when he saves the document. The code which i have used in
private void oWord_DocumentBeforeSave(Word.Document doc, ref bool SaveAsUI,
ref bool Cancel)
{
SetWordHeaderFooter();
}
Is there any way i can handle Cancel button click event when user clicks on
Cancel in Save dialog box. Any helpon this is highlt appreaciated.
Thanks in Advance
Loading...