NewExplorer isn't firing in this case because the Explorer is already there
when you subscribe to the NewExplorer event. That's obvious because you've
already accessed ActiveExplorer. Do your initial resizing in
ThisApplication_Startup.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
wrote in message
oups.com...
I am building a C# Outlook add-in. When a new explorer window is
launched I subscribe to the event and resize the window. However, the
window refuses to resize and remains the same size as it was launched
initially. The initial size is the same as the initial explorer size
when outlook is opened for the first time.
Is there a way to resize the explorer windows appropriately? I am not
facing a problem with inspector windows.
I am ensuring that before resizing is done the Window state is set to
olNormalized and is not in the Maximized or Minimized state.
I am pasting snippet of my code here
Outlook.Explorers _exp;
Outlook.Inspectors _ins;
private void ThisApplication_Startup(object sender, System.EventArgs
e)
{
if (this.ActiveExplorer().WindowState ==
Microsoft.Office.Interop.Outlook.OlWindowState.olM aximized)
{
this.ActiveExplorer().WindowState =
Microsoft.Office.Interop.Outlook.OlWindowState.olN ormalWindow;
}
_exp = this.Explorers;
_ins = this.Inspectors;
_exp.NewExplorer +=new
Microsoft.Office.Interop.Outlook.ExplorersEvents_N ewExplorerEventHandler(_exp_NewExplorer);
_ins.NewInspector += new
Microsoft.Office.Interop.Outlook.InspectorsEvents_ NewInspectorEventHandler(_ins_NewInspector);
}
void _exp_NewExplorer(Microsoft.Office.Interop.Outlook. Explorer
Explorer)
{
Explorer.Width = 400;
Explorer.Height = 400;
Explorer.Top = 50;
Explorer.Left = 50;
}
Please help.