K
kmcmanus
I am trying to display my own custom SaveAs dialog that will allow the user
to save to a database instead of the file system.
I have got the dialog working correctly, but cannot seam to trap when the
user presses cancel. I can detect this from my own saveas dialog but cannot
prevent the user from seeing the standard 'saveas' after canceling my own
dialog.
Below is a simplified version of my code (c#) that produces the error.
I have tried the obvious things, and confirmed that there are no other
addins running.
public void OnConnection(object application, Extensibility.ext_ConnectMode
connectMode, object addInInst, ref System.Array custom)
{
applicationObject = application;
addInInstance = addInInst;
if (applicationObject is Word.Application)
{
MessageBox.Show("Word");
((Word.Application)applicationObject).DocumentBeforeSave += new
Microsoft.Office.Interop.Word.ApplicationEvents3_DocumentBeforeSaveEventHandler(Connect_DocumentBeforeSave);
}
}
private void
Connect_DocumentBeforeSave(Microsoft.Office.Interop.Word.Document Doc, ref
bool SaveAsUI, ref bool Cancel)
{
MessageBox.Show("Before Save");
SaveAsUI = false;
Cancel = true;
}
to save to a database instead of the file system.
I have got the dialog working correctly, but cannot seam to trap when the
user presses cancel. I can detect this from my own saveas dialog but cannot
prevent the user from seeing the standard 'saveas' after canceling my own
dialog.
Below is a simplified version of my code (c#) that produces the error.
I have tried the obvious things, and confirmed that there are no other
addins running.
public void OnConnection(object application, Extensibility.ext_ConnectMode
connectMode, object addInInst, ref System.Array custom)
{
applicationObject = application;
addInInstance = addInInst;
if (applicationObject is Word.Application)
{
MessageBox.Show("Word");
((Word.Application)applicationObject).DocumentBeforeSave += new
Microsoft.Office.Interop.Word.ApplicationEvents3_DocumentBeforeSaveEventHandler(Connect_DocumentBeforeSave);
}
}
private void
Connect_DocumentBeforeSave(Microsoft.Office.Interop.Word.Document Doc, ref
bool SaveAsUI, ref bool Cancel)
{
MessageBox.Show("Before Save");
SaveAsUI = false;
Cancel = true;
}