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 / Programming Add-Ins / January 2007

Tip: Looking for answers? Try searching our database.

Modifying the email message window

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brent - 26 Jan 2007 23:43 GMT
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
Brent - 27 Jan 2007 07:29 GMT
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

> Hi everyone,
>
[quoted text clipped - 40 lines]
>
> Brent
Ken Slovak - [MVP - Outlook] - 29 Jan 2007 14:04 GMT
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.

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

> 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
[quoted text clipped - 10 lines]
>
> Brent
 
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



©2008 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.