You will need to handle Word events in your Inspector handler. When the Word_WindowActivate event fires you need to check for wn.EnvelopeVisible = True. If that is true you are in an active email window, if false it's a Word document window.
If it's a Word document you need to hide your UI by setting the .Visible and ..Enabled properties to false. Set them true if it's an email window.
You also will probably have to re-instantiate your button objects and other UI each time you access it that way, or you will get errors that the properties are not available. That's a specific problem, as is the fact that Word does not honor the Temporary := True argument. So you will have to explicitly delete your UI when the Inspector is closing.
Google for other posts I've made here and in the other Outlook programming groups about the other problems with WordMail Inspectors and how to handle them. You'll also find code samples.
For your other problem you will need to add a unique Tag property to each button and other UI object you create. You will also need to set up an Inspector wrapper class and collection to handle multiple open Inspectors.
Since you did not mention what language you are programming in or what development platform you are using I can't recommend any specific Inspector wrapper samples, but they are out there for VB 6 and VB.NET and C#.
-- 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
"Harry" <harshal.choudhari[ at ]gmail.com> wrote in message news:1170833749.425912.205910[ at ]l53g2000cwa.googlegroups.com...
[Quoted Text] > Hi, > I am getting problem when i am trying to add new toolbar on > NewInspector window of Outlook 2003. > > 1) I am able to add a new toolbar, but my first problem is that, this > added toolbar is also gets visible/enable when i open the Word > Application. That is the CommandBar of Word Application also gets > modified when i modify the CommandBar of Inspector collection of > Outlook 2003. > > 2) And my second problem is---- > I have added the button on this new toolbar. It works > fine for single instance of Inspector, but when there are multiple > instance of Inspector then on click of button the fuctionality of it > gets call by number of times as much as instance of Inspector are > open. > > Please help out, i am really get frusted as i have spend lots of time > on it and i have to submit this as early as possible. > > -Thanks >
|