Group:  Microsoft Outlook ยป microsoft.public.outlook.program_addins
Thread: Problem with Inspector CommandBars and MS Word

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Problem with Inspector CommandBars and MS Word
Yuri Loban 10.07.2006 09:55:02
Hello all,

I have a next problem:

My Add-in adds a custom CommandBar with button into MailItem Inspector's
CommandBars object via NewInspector event. The MS Word editor is switched on.
It works properly.

But... If MS Word application was run before the MailItem Inspector was
opened (for example New Mail Message action), the Inspector's CommandBars
refers on MS Word application commandBar object !!!, therefor my custom
commandBar appears in MS Word application and action received from my custom
button from MS Word, not from Outlook MailItem Inspector.
What is wrong? How can I obtain Outlook Inspector CommandBar?

Regards,
Yuri
Re: Problem with Inspector CommandBars and MS Word
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 11.07.2006 13:56:47
Inspector.CommandBars works in all cases. With WordMail you can hide your
buttons when the mail envelope is not exposed using an events aware
Word.Application object in your Outlook code and handling the WindowActivate
event. If Window.EnvelopeVisible = True then the mailer is displayed. If
False then it's a Word document object.

With WordMail you are limited in which toolbars you can use and display, you
can work with Standard or create your own toolbar.

--
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


"Yuri Loban" <Yuri Loban[ at ]discussions.microsoft.com> wrote in message
news:32114A0C-31C0-4B50-AF8C-979128EAFAE6[ at ]microsoft.com...
[Quoted Text]
> Hello all,
>
> I have a next problem:
>
> My Add-in adds a custom CommandBar with button into MailItem Inspector's
> CommandBars object via NewInspector event. The MS Word editor is switched
> on.
> It works properly.
>
> But... If MS Word application was run before the MailItem Inspector was
> opened (for example New Mail Message action), the Inspector's CommandBars
> refers on MS Word application commandBar object !!!, therefor my custom
> commandBar appears in MS Word application and action received from my
> custom
> button from MS Word, not from Outlook MailItem Inspector.
> What is wrong? How can I obtain Outlook Inspector CommandBar?
>
> Regards,
> Yuri

Re: Problem with Inspector CommandBars and MS Word
Yuri Loban 11.07.2006 16:01:02
Thanks for your advise. But, one problem is still here: I've used commandBar,
as you recomended, and it appears in both Outlook and Word application (?).
And unfortunately, my notification event for button in commandBar is attached
in Word application, not in Outlook. What could you guess?

"Ken Slovak - [MVP - Outlook]" wrote:

[Quoted Text]
> Inspector.CommandBars works in all cases. With WordMail you can hide your
> buttons when the mail envelope is not exposed using an events aware
> Word.Application object in your Outlook code and handling the WindowActivate
> event. If Window.EnvelopeVisible = True then the mailer is displayed. If
> False then it's a Word document object.
>
> With WordMail you are limited in which toolbars you can use and display, you
> can work with Standard or create your own toolbar.
>
> --
> 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
>
>
> "Yuri Loban" <Yuri Loban[ at ]discussions.microsoft.com> wrote in message
> news:32114A0C-31C0-4B50-AF8C-979128EAFAE6[ at ]microsoft.com...
> > Hello all,
> >
> > I have a next problem:
> >
> > My Add-in adds a custom CommandBar with button into MailItem Inspector's
> > CommandBars object via NewInspector event. The MS Word editor is switched
> > on.
> > It works properly.
> >
> > But... If MS Word application was run before the MailItem Inspector was
> > opened (for example New Mail Message action), the Inspector's CommandBars
> > refers on MS Word application commandBar object !!!, therefor my custom
> > commandBar appears in MS Word application and action received from my
> > custom
> > button from MS Word, not from Outlook MailItem Inspector.
> > What is wrong? How can I obtain Outlook Inspector CommandBar?
> >
> > Regards,
> > Yuri
>
>
Re: Problem with Inspector CommandBars and MS Word
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 11.07.2006 19:26:35
If your code runs and adds the button to the
Inspectors.CommandBars.Item("Standard") toolbar you should receive the Click
event in your Outlook code. I just add a button as usual whether it's
WordMail or not.

There are other things to account for with WordMail, such as the buttons
being in the Normal.dot template or wherever your CustomizationContext is
and when to hide and show the buttons, but the click event should fire
within your Outlook addin code.

If WordMail is running (Inspector.IsWordmail = True) then
Inspector.WordEditor is the Word Document object. WordEditor.Application is
Word.Application and WordEditor.ActiveWindow is your Word window. I already
mentioned how to figure out when to show or hide your buttons
(Window.EnvelopeVisible = True means WordMail is showing). Setting
CustomizationContext.Saved = True after adding or deleting your buttons will
prevent dialogs asking the user to save Normal.dot changes. You must
explicitly delete any WordMail buttons you add as Word does not honor the
Temporary = True argument. So you delete all your buttons when the Inspector
is closing.

Other than those things buttons in WordMail or the Outlook email editor are
the same.

--
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


"Yuri Loban" <YuriLoban[ at ]discussions.microsoft.com> wrote in message
news:82862DB0-3D63-4B90-9866-E128BB3E639E[ at ]microsoft.com...
[Quoted Text]
> Thanks for your advise. But, one problem is still here: I've used
> commandBar,
> as you recomended, and it appears in both Outlook and Word application
> (?).
> And unfortunately, my notification event for button in commandBar is
> attached
> in Word application, not in Outlook. What could you guess?

Re: Problem with Inspector CommandBars and MS Word
Yuri Loban 12.07.2006 05:26:01
Thanks a lot!!!

"Ken Slovak - [MVP - Outlook]" wrote:

[Quoted Text]
> If your code runs and adds the button to the
> Inspectors.CommandBars.Item("Standard") toolbar you should receive the Click
> event in your Outlook code. I just add a button as usual whether it's
> WordMail or not.
>
> There are other things to account for with WordMail, such as the buttons
> being in the Normal.dot template or wherever your CustomizationContext is
> and when to hide and show the buttons, but the click event should fire
> within your Outlook addin code.
>
> If WordMail is running (Inspector.IsWordmail = True) then
> Inspector.WordEditor is the Word Document object. WordEditor.Application is
> Word.Application and WordEditor.ActiveWindow is your Word window. I already
> mentioned how to figure out when to show or hide your buttons
> (Window.EnvelopeVisible = True means WordMail is showing). Setting
> CustomizationContext.Saved = True after adding or deleting your buttons will
> prevent dialogs asking the user to save Normal.dot changes. You must
> explicitly delete any WordMail buttons you add as Word does not honor the
> Temporary = True argument. So you delete all your buttons when the Inspector
> is closing.
>
> Other than those things buttons in WordMail or the Outlook email editor are
> the same.
>
> --
> 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
>
>
> "Yuri Loban" <YuriLoban[ at ]discussions.microsoft.com> wrote in message
> news:82862DB0-3D63-4B90-9866-E128BB3E639E[ at ]microsoft.com...
> > Thanks for your advise. But, one problem is still here: I've used
> > commandBar,
> > as you recomended, and it appears in both Outlook and Word application
> > (?).
> > And unfortunately, my notification event for button in commandBar is
> > attached
> > in Word application, not in Outlook. What could you guess?
>
>

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net