Two CommandBarButtons runs the same code

Joined
Jun 18, 2006
Messages
3
Reaction score
0
Hi ,
I create two CommandBarButtons in two seperate projects.I add This buttons to the standard Command bar. When I click one of them the event runs the code of the both AddIns. To solve this problem I add the 'OnAction' property on the creation of the buttons, but it doesn't help, each button runs the code of the both AddIns .

Here the code :
'The first button :
Private Sub CreateButtons(objInspector As Outlook.Inspector)
On Error Resume Next

'Adding a new menu item and a button to the main menu for any Inspector
' must take a different approach if using Word as email editor.

Dim objCB As Office.CommandBar
Dim strKey As String

Set objCB = m_objInsp.CommandBars("standard")

strKey = CStr(m_intID)
strTag = "This string is unique to this button" & strKey
Set cbbFaxButton = objCB.Controls.Add(Type:=msoControlButton, Temporary:=True)

With cbbFaxButton
.ToolTipText = "Send fax"
.Tag = strTag
.Style = msoButtonIconAndCaption
.FaceId = 461
.Caption = "fax"
.Visible = True
.OnAction = "<!" & strProgId & ">"
End With

Set objCB = Nothing
Err.Clear

End Sub
**************
The .OnAction property get this value :
<!FaxSystem.fax_Connect>


'*** The second button

Private Sub CreateButtons(objInspector As Outlook.Inspector)
On Error Resume Next

Dim oPic As StdPicture
Dim objCB As Office.CommandBar
Dim strKey As String

Set objCB = objInspector.CommandBars("standard")

strKey = CStr(m_intID)
strTag = "This string is unique to this button" & strKey
Set cbbButton = objCB.Controls.Add(Type:=msoControlButton, Temporary:=True)

With cbbButton
.ToolTipText = "Send to Mrkv"
.Tag = strTag
.Style = msoButtonIconAndCaption
.Caption = "Mrkv"
.Visible = True
.OnAction = "<!" & strProgId & ">"

End With

Set objCB = Nothing
Set objOutAddIn = Nothing
Err.Clear

End Sub

**********
The .OnAction property get this value :
<!Merkava.Mrkv_Connect>

How can I solve this problem ?

Thanks,
David
 

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