A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

button not firing when word is set as MailEditor.



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 11th 07, 04:43 PM posted to microsoft.public.outlook.program_addins
Joe
external usenet poster
 
Posts: 3
Default button not firing when word is set as MailEditor.

Hi all

this is a much discussed problem, i m trying to use an outlook addin
which creates a button to the newInspector on clik of which some form
is opend.

it works fine for me when use all the other editors.. except word.

i ve seen Ken's post n other which suggest me to use Word Object
model. but i dont get how exactly should i do it.

here is my code in newInspector event :

Office.CommandBars oCommandBars;
Office.CommandBar oStandardBar;
myInspector = inspector;
oCommandBars = inspector.CommandBars;
oStandardBar = oCommandBars["Standard"];

Microsoft.Office.Interop.Word.Document ObjEditor;
try
{

if (inspector.IsWordMail() == false)
{
// code for other editors..
}
else
{
Redemption.SafeInspector safeInspector =
( Redemption.SafeInspector )
appObject.CreateObject( "Redemption.SafeInspector" );
safeInspector = ( Redemption.SafeInspector )
inspector;

ObjEditor =
(Microsoft.Office.Interop.Word.Document)safeInspec tor.WordEditor;
object omissing = System.Reflection.Missing.Value;
oStandardBar = ObjEditor.CommandBars["Standard"];
try
{
inspectorButton =
(Office.CommandBarButton)oStandardBar.Controls["Insert Invite"];
}
catch (Exception)
{

//inspectorButton =
(Office.CommandBarButton)oStandardBar.Controls["Insert Invite"];
inspectorButton =
(Office.CommandBarButton)oStandardBar.Controls.Add (1, omissing,
omissing, omissing, true);
inspectorButton.Caption = "Insert Link";
inspectorButton.Style =
Office.MsoButtonStyle.msoButtonIconAndCaption;
inspectorButton.OnAction = "!
InsertLink.Connect";
inspectorButton.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(this.inspectorButton_Click);
}
}
}
catch (Exception)
{

}

oCommandBars = null;
oStandardBar = null;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
but the Click event doesnt fire.. i ve seen some posts asking to use
Redemption. So i ve tried using that..

Please do give your opinions..

This is very critical to me as Outlook sets word as editor by
default.

thanks in advance.

Joe augustine.

  #2  
Old June 13th 07, 04:19 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default button not firing when word is set as MailEditor.

First of all, never use NewInspector to add UI. Use the first Activate
event. I just add my UI to Inspector.CommandBars, I never directly add to
the Word object. Where I do use the Word object is in Window_Activate to see
if it's an email window or a doc and to handle enabling/disabling my UI
appropriately.

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


"Joe" wrote in message
ups.com...
Hi all

this is a much discussed problem, i m trying to use an outlook addin
which creates a button to the newInspector on clik of which some form
is opend.

it works fine for me when use all the other editors.. except word.

i ve seen Ken's post n other which suggest me to use Word Object
model. but i dont get how exactly should i do it.

here is my code in newInspector event :

Office.CommandBars oCommandBars;
Office.CommandBar oStandardBar;
myInspector = inspector;
oCommandBars = inspector.CommandBars;
oStandardBar = oCommandBars["Standard"];

Microsoft.Office.Interop.Word.Document ObjEditor;
try
{

if (inspector.IsWordMail() == false)
{
// code for other editors..
}
else
{
Redemption.SafeInspector safeInspector =
( Redemption.SafeInspector )
appObject.CreateObject( "Redemption.SafeInspector" );
safeInspector = ( Redemption.SafeInspector )
inspector;

ObjEditor =
(Microsoft.Office.Interop.Word.Document)safeInspec tor.WordEditor;
object omissing = System.Reflection.Missing.Value;
oStandardBar = ObjEditor.CommandBars["Standard"];
try
{
inspectorButton =
(Office.CommandBarButton)oStandardBar.Controls["Insert Invite"];
}
catch (Exception)
{

//inspectorButton =
(Office.CommandBarButton)oStandardBar.Controls["Insert Invite"];
inspectorButton =
(Office.CommandBarButton)oStandardBar.Controls.Add (1, omissing,
omissing, omissing, true);
inspectorButton.Caption = "Insert Link";
inspectorButton.Style =
Office.MsoButtonStyle.msoButtonIconAndCaption;
inspectorButton.OnAction = "!
InsertLink.Connect";
inspectorButton.Click += new
Microsoft.Office.Core._CommandBarButtonEvents_Clic kEventHandler(this.inspectorButton_Click);
}
}
}
catch (Exception)
{

}

oCommandBars = null;
oStandardBar = null;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
but the Click event doesnt fire.. i ve seen some posts asking to use
Redemption. So i ve tried using that..

Please do give your opinions..

This is very critical to me as Outlook sets word as editor by
default.

thanks in advance.

Joe augustine.


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MouseWheel event not firing aiKeith Outlook - Using Forms 1 February 9th 07 09:07 PM
Command buttons when using word as email button [email protected] Add-ins for Outlook 1 October 9th 06 10:27 PM
vbScript Not Firing Boyd Outlook - Using Forms 2 September 29th 06 11:58 PM
Adding a button when using word to display rtf messages fails james Add-ins for Outlook 4 August 13th 06 07:42 PM
AdvancedSearchComplete Even Not Firing Dav Banks Outlook and VBA 8 June 8th 06 10:18 PM


All times are GMT +1. The time now is 08:45 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.