K
Krishna
Hi,
I am writing a plugin to Outlook 2003 using C#.
I am having problems closing the inspector when IsWordMail() returns
true. The code segment in my InspectorClose Event handler is as
follows:
if (myInspector.IsWordMail())
{
object objSaveChanges =
WdSaveOptions.wdDoNotSaveChanges;
object objOrigFormat =
WdOriginalFormat.wdOriginalDocumentFormat;
object objRouteDoc = false;
Microsoft.Office.Interop.Word.Application applWord
= (myInspector.WordEditor as
Microsoft.Office.Interop.Word._Document).Application;
(myInspector.WordEditor as
Microsoft.Office.Interop.Word._Document).Close(ref objSaveChanges, ref
objOrigFormat, ref objRouteDoc);
objSaveChanges = WdSaveOptions.wdDoNotSaveChanges;
objOrigFormat =
WdOriginalFormat.wdOriginalDocumentFormat;
objRouteDoc = false;
applWord.CommandBars[myCommandBar.Index].Delete();
(applWord as
Microsoft.Office.Interop.Word._Application).Quit(ref myMissing, ref
myMissing, ref myMissing);
}
What's happening is that eventually the inspector is closing, but
when-ever i close the inspector, a new email is opened with some crazy
dump as the message body and then everything closes as expected,
automatically. I cannot understand what is happening and why. Can
someone help me with what I am doing wrong. Or, if there is any better
way to do this.
I am writing a plugin to Outlook 2003 using C#.
I am having problems closing the inspector when IsWordMail() returns
true. The code segment in my InspectorClose Event handler is as
follows:
if (myInspector.IsWordMail())
{
object objSaveChanges =
WdSaveOptions.wdDoNotSaveChanges;
object objOrigFormat =
WdOriginalFormat.wdOriginalDocumentFormat;
object objRouteDoc = false;
Microsoft.Office.Interop.Word.Application applWord
= (myInspector.WordEditor as
Microsoft.Office.Interop.Word._Document).Application;
(myInspector.WordEditor as
Microsoft.Office.Interop.Word._Document).Close(ref objSaveChanges, ref
objOrigFormat, ref objRouteDoc);
objSaveChanges = WdSaveOptions.wdDoNotSaveChanges;
objOrigFormat =
WdOriginalFormat.wdOriginalDocumentFormat;
objRouteDoc = false;
applWord.CommandBars[myCommandBar.Index].Delete();
(applWord as
Microsoft.Office.Interop.Word._Application).Quit(ref myMissing, ref
myMissing, ref myMissing);
}
What's happening is that eventually the inspector is closing, but
when-ever i close the inspector, a new email is opened with some crazy
dump as the message body and then everything closes as expected,
automatically. I cannot understand what is happening and why. Can
someone help me with what I am doing wrong. Or, if there is any better
way to do this.