Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Interop / November 2006

Tip: Looking for answers? Try searching our database.

Problems closing inspector when IsWordMail() is true

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Krishna - 29 Nov 2006 23:04 GMT
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.
Ken Slovak - [MVP - Outlook] - 30 Nov 2006 14:22 GMT
I usually just call to close the document object without saving changes
after deleting any controls I created. I then set CustomizationContext.Saved
to whatever I want and that's it.

Quitting Word will slow things down a lot and shouldn't be necessary. It can
run in the background. Closing it will make it re-load again the next time
an email is opened.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

> Hi,
> I am writing a plugin to Outlook 2003 using C#.
[quoted text clipped - 34 lines]
> someone help me with what I am doing wrong. Or, if there is any better
> way to do this.
Krishna - 30 Nov 2006 19:05 GMT
Thanks Ken.

Your reply gave me confidence to catch my bug.

The actual problem was else-where with my code. It had something to do
with the plug-in I was writing when the user simply clicks a new email
and closes it without doing anything. I was reading the HTML body and
doing some weird things.

As you suggested, I am not quitting word now.

Thanks,
Krishna.

> I usually just call to close the document object without saving changes
> after deleting any controls I created. I then set CustomizationContext.Saved
[quoted text clipped - 50 lines]
> > someone help me with what I am doing wrong. Or, if there is any better
> > way to do this.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.