Commandbar not getting added to inspector when word is used as editor

K

kishore

Hi,
I have written a Com Add-in which adds a new Commandbar to
the New Mail window. I am using the NewInspector event to
place a Commandbar with buttons on a new mail Inspector
window , I.e. Whenever New Mail message window is opened.
I have created a new commandbar and aded a new
commandbutton on that newly created commandbar.

Everything is working fine if i use HTML as mail editor.
If i use word as the default mail editor in outlook, then
the commandbar is not getting added and also the buttons.

Could someone please suggest me what i should do to add
the commandbars to the word mail editor when i open the
new mail window.

I.e when I create a New mail message using MS Word mail
editor option, what should i do to add my owm custom bar.

Thanks
 
P

Paul Linton

I have the following code in the NewInspector event and it
adds a CommandBar with Button, we always use Word as our e-
mail editor here. Hope it helps

Private Sub oiInspectors_NewInspector(ByVal Inspector As
Inspector)
Dim oi As CommandBar
Dim cbrCmdBar As CommandBar
Dim strCBarName As String
Dim ctlInsert As CommandBarButton

If Inspector.IsWordMail Then
MsgBox "EditorType is Word"
MsgBox "There are " & Inspector.CommandBars.Count
& " command bars"
strCBarName = "LTGCommandBar"
On Error Resume Next
Set cbrCmdBar = Inspector.CommandBars(strCBarName)
If cbrCmdBar Is Nothing Then
Err.Clear
Set cbrCmdBar = Inspector.CommandBars.Add
(Name:=strCBarName)
cbrCmdBar.Visible = True
Set ctlInsert = cbrCmdBar.Controls.Add
With ctlInsert
.Style = msoButtonCaption
.Caption = "My First Button"
.Tag = "My First Button"
.OnAction = "Test"
End With
End If
For Each oi In Inspector.CommandBars
If oi.Visible Then
MsgBox oi.Name
End If
Next
Else
MsgBox Inspector.EditorType
End If

I have the action ("Test") for the button as a macro in
normal.dot.

cheers
Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top