Re: How to add button on Mail editor which is not outlook.??



Hi,

I'm having similar kind of pblm. If I add any button to the outlook word
editor, then i open another word instance, the new word instance shows the
custom command bar which I've added to outlook word editor. But it shdn't
appear in the new word instance.

Could you pls advice me to achieve the same?

Thanks & Regards
Ashok

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

You can't just assume the user is using the HTML editor if they're not using
Word, they might be using plain text or RTF as their defaults. You should
check the EditorType property.

Also, for a button in an addin you will want to use the ProgID you get in
the On_Connection event handler to set up the OnAction property for your
button:
osendButton.OnAction = "!<" & g_strProgID & ">"

See if that helps.

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


"Gaurav Khare" <GauravKhare@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:000383E5-358F-4FEB-8FEF-A5C504EEAEBC@xxxxxxxxxxxxxxxx
Hi ken,
I tried using your method and it worked but there are two problems ..
1. when using Word Editor--> my button's click event is not firing. I
tried
to catch its click event like other custom buttons that i have added on
outlook but it did'nt work.
2. when using HTML Editor--> I tried to create button like as in word
editor
and like those in outlook but in both cases the button coud not get added.
When adding like word editor it gives "obects property not supported".
I used the following code......
Private WithEvents osendButton As Office.CommandBarButton
If Inspector.IsWordMail Then
Set objEditor = Inspector.WordEditor
Else
Set objEditor = Inspector.HTMLEditor
End If
If Not objEditor.CommandBars("Standard").Controls.Item(1).Caption =
"Send and Add to Intelligent" Then
Set osendButton =
objEditor.CommandBars("Standard").Controls.Add(Temporary:=True, Before:=1)
osendButton.Caption = "Send and Add to Intelligent"
osendButton.Visible = True
osendButton.DescriptionText = "Send and Add to Intelligent"
osendButton.ToolTipText = "Send and to Intelligent office also"
osendButton.Style = msoButtonCaption
osendButton.BuiltInFace = True
osendButton.Visible = True
End if

This worked well when case is "Word Editor" but its click event does not
fired.
for its click event i wrote.......

Private Sub osendButton_Click(ByVal Ctrl As Office.CommandBarButton,
CancelDefault As Boolean)
MsgBox ("Going to Intelligent.....")
End Sub

But when case is "HTML Editor" it gives the following error....

"Objects property not supported..."

I also tried using this code for HTML Editor...But it also didnt work....
Private WithEvents moOL As Outlook.Application
Set oCBs = moOL.ActiveInspector.CommandBars
Set oMenuBar = oCBs.ActiveMenuBar
oMenuBar.Visible = True
Set osendButton = oMenuBar.Controls.Add(msoControlButton, , , , True)
osendButton.Caption = "Add to Intelligent Office"
osendButton.Enabled = False
osendButton.Visible = True


please help me for both cases...
1. "Click event for Button in word editor"
2. Adding button and its click event in HTML editor
Looking forward from your side.....



--
Gaurav khare
software engineer
Ots Solutions Pvt Ltd


.


Loading