
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
Hi Ken, running with similar kind of problem.
I did as you mention, but could not get it working. Will appeciate
your help.
Private objCB As Office.CommandBar
Private WithEvents objCBButton As Office.CommandBarButton
Private Sub colInsp_NewInspector()
Dim mydoc As Word.Document
If Inspector.IsWordMail Then
Set mydoc = Inspector.WordEditor
Set objCB = mydoc.CommandBars("Standard")
Set objCBButton = CreateAddInCommandBarButton(strProgID, objCB,
"SMS", "SMS
Extension", "Send SMS Message", 0, True,
msoButtonIconAndCaption)
End Sub
Now CreateAddInCommandBarButton this bit of code I got it from the
"Com Addin for Outloom Template" form the www.Slipstick.com website.
It works fine when i use plain Text but not when using word as emial
editor.
Anyway, i will put the code here.
In this function when using word as editor, i still get ctlBtnAddIn as
Nothing
after the following line of code, where as when using plain Text i
have that object
Set ctlBtnAddIn = objCommandBar.Controls.Add(Type:=msoControlButton,
Parameter:=strTag)
Public Function CreateAddInCommandBarButton _
(strProgID As String, objCommandBar As CommandBar, _
strCaption As String, strTag As String, strTip As String, _
intFaceID As Integer, blnBeginGroup As Boolean, intStyle As
Integer) _
As Office.CommandBarButton
Dim ctlBtnAddIn As CommandBarButton
Dim objPicture As stdole.IPictureDisp
Dim objMask As stdole.IPictureDisp
Dim str As String
str = App.Path + "\MESSAGEmanager.bmp"
On Error Resume Next
' Test to determine if button exists on command bar.
Set ctlBtnAddIn = objCommandBar.FindControl(Tag:=strTag)
If ctlBtnAddIn Is Nothing Then
' Add new button.
Set ctlBtnAddIn =
objCommandBar.Controls.Add(Type:=msoControlButton,
Parameter:=strTag)
Set objPicture = LoadPicture(str)
Set objMask = LoadPicture(str)
With ctlBtnAddIn
.Caption = strCaption
.Tag = strTag
'for image comment these three lines
If intStyle <> msoButtonIconAndCaption Then
.FaceId = intFaceID
End If
.Style = intStyle
.Picture = objPicture
.Mask = objMask
.ToolTipText = strTip
.BeginGroup = blnBeginGroup
' Set the OnAction property with ProgID of Add-In
.OnAction = "<!" & strProgID _
& ">"
End With
End If
' Return reference to new commandbar button.
Set CreateAddInCommandBarButton = ctlBtnAddIn
End Function
> The way I get the current document in the Word editor is different, see if
> this helps:
[quoted text clipped - 35 lines]
> > regards,
> > Shiv
Ken Slovak - [MVP - Outlook] - 07 Apr 2004 15:10 GMT
Buttons in WordMail must be created using Word code and not Outlook code.
You'd have to put the code in an autorun macro in Word's normal.dot template
and in that code check to see if the document was an email so the button
wasn't there for normal documents.

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
> Hi Ken, running with similar kind of problem.
>
> I did as you mention, but could not get it working. Will appeciate
> your help.
<snip
Mita Garg - 08 Apr 2004 01:25 GMT
Hi Ken,
Thanks for your reply. Would you mind posting a sample, because I have
no idea how to do that. and If a create the button in a macro, how
will my Addin respond to the button click event. How am i going to
distribute( or deploy) that macro on the client machine.
> Buttons in WordMail must be created using Word code and not Outlook code.
> You'd have to put the code in an autorun macro in Word's normal.dot template
[quoted text clipped - 6 lines]
> > your help.
> <snip
Ken Slovak - [MVP - Outlook] - 08 Apr 2004 21:27 GMT
Your Word code would have to handle the click events and somehow pass
anything that's needed to the Outlook addin. Some people have created dual
addins that have designers for both Outlook and Word and do things that way.
I don't do that type of coding and really never have bothered with buttons
on WordMail Inspectors so I can't give you more detail or any sample code.
You can try Googling to see if there are any posts that show sample code for
it or even maybe try a Word newsgroup.

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
> Hi Ken,
>
> Thanks for your reply. Would you mind posting a sample, because I have
> no idea how to do that. and If a create the button in a macro, how
> will my Addin respond to the button click event. How am i going to
> distribute( or deploy) that macro on the client machine.