Group:  Microsoft Outlook ยป microsoft.public.outlook.program_addins
Thread: Modifying the email message window

Geek News

Modifying the email message window
Brent <a[ at ]b.c> 1/26/2007 11:43:43 PM




Hi everyone,

I'm trying to add a command bar to the email message window that opens
when you click on "New". I'm trying to do this in C# and am somewhat new
to the Outlook object model. Upon looking at the msdn documentation I
tried using the NewInspector event as follows:



private Outlook.Inspectors myInspectors;

public void Initialize_handler()
{
myInspectors = this.Application.Inspectors;
}

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
Initialize_handler();
}

private void MyInspectors_NewInspector(Outlook.Inspector Inspector)
{
myBar = Inspector.Commandbars.Add(commandBarName,
Office.MsoBarPosition.msoBarTop, false, true);
}



I've probably not interpreted the VBA documentation correctly. The
object model reference has the following:



Dim myOlApp As New Outlook.Application
Public WithEvents myOlInspectors As Outlook.Inspectors

Public Sub Initialize_handler()
Set myOlInspectors = myOlApp.Inspectors
End Sub

Private Sub myOlInspectors_NewInspector(ByVal Inspector As
outlook.Inspector)
Inspector.CommandBars.Item("Standard").Visible = True
Inspector.CommandBars.Item("Formatting").Visible = True
End Sub


Was I following the right approach? Thanks for any advice!


Brent








Re: Modifying the email message window
Brent <a[ at ]b.c> 1/27/2007 7:29:10 AM


I've tracked down the problem. There seems to be an issue when Outlook
2003 is using Word 2003 as the email editor. I had a .rtf file open and
all the command bars were getting added there.

I'd like to sort that out eventually but for now it can be alleviated by
unselecting Word 2003 as the email editor under "Options".

My code below is also incorrect and needs:

myInspectors.NewInspector += new
Outlook.InspectorsEvents_NewInspectorEventHandler
(MyInspectors_NewInspector);


Brent



Brent <a[ at ]b.c> wrote in news:Xns98C4A00104CA3abc[ at ]140.99.99.130:

[Quoted Text]
>
>
>
>
> Hi everyone,
>
> I'm trying to add a command bar to the email message window that opens
> when you click on "New". I'm trying to do this in C# and am somewhat
new
> to the Outlook object model. Upon looking at the msdn documentation I
> tried using the NewInspector event as follows:
>
>
>
> private Outlook.Inspectors myInspectors;
>
> public void Initialize_handler()
> {
> myInspectors = this.Application.Inspectors;
> }
>
> private void ThisAddIn_Startup(object sender, System.EventArgs e)
> {
> Initialize_handler();
> }
>
> private void MyInspectors_NewInspector(Outlook.Inspector Inspector)
> {
> myBar = Inspector.Commandbars.Add(commandBarName,
> Office.MsoBarPosition.msoBarTop, false, true);
> }
>
>
>
> I've probably not interpreted the VBA documentation correctly. The
> object model reference has the following:
>
>
>
> Dim myOlApp As New Outlook.Application
> Public WithEvents myOlInspectors As Outlook.Inspectors
>
> Public Sub Initialize_handler()
> Set myOlInspectors = myOlApp.Inspectors
> End Sub
>
> Private Sub myOlInspectors_NewInspector(ByVal Inspector As
> outlook.Inspector)
> Inspector.CommandBars.Item("Standard").Visible = True
> Inspector.CommandBars.Item("Formatting").Visible = True
> End Sub
>
>
> Was I following the right approach? Thanks for any advice!
>
>
> Brent
>
>
>
>
>
>
>
>

Re: Modifying the email message window
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 1/29/2007 2:04:26 PM
To get your UI only showing in WordMail and not Word documents you have to
handle Word code events in your Inspector handler. In the
Word_WindowActivate event you can check for Window.EnvelopeVisible and if
it's true that's a WordMail window. If false it's a Word doc. You can set
your UI visible and enabled properties accordingly.

You should not use NewInspector to set up your UI, that will fail in many
cases. In the Inspector events use the first Inspector.Activate event to
trigger creating your UI.

WordMail also does not honor the Temporary argument and your UI will be
permanent unless you take steps to delete it when the WordMail window is
closing.

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


"Brent" <a[ at ]b.c> wrote in message news:Xns98C4EEEB2C80abc[ at ]140.99.99.130...
[Quoted Text]
>
>
> I've tracked down the problem. There seems to be an issue when Outlook
> 2003 is using Word 2003 as the email editor. I had a .rtf file open and
> all the command bars were getting added there.
>
> I'd like to sort that out eventually but for now it can be alleviated by
> unselecting Word 2003 as the email editor under "Options".
>
> My code below is also incorrect and needs:
>
> myInspectors.NewInspector += new
> Outlook.InspectorsEvents_NewInspectorEventHandler
> (MyInspectors_NewInspector);
>
>
> Brent

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