Adding a CommandBar Button using VS 2003

J

jdgang

I am trying to add a command bar button using vb.net in visual studio 2003.
When I set a break point and step into the code it works fine. When I compile
the code and just run the add-in it does not...any suggestions

Here is a copy of the code
Public Sub OnConnection(ByVal application As Object, ByVal connectMode As
Extensibility.ext_ConnectMode, ByVal addInInst As Object, ByRef custom As
System.Array) Implements Extensibility.IDTExtensibility2.OnConnection
'Gets Namespace and creates mailitem to check to see if button exist
if not exist create button
applicationObject = application
addInInstance = addInInst
Dim test As String
On Error Resume Next
oApp = application
oNS = oApp.GetNamespace("MAPI") 'get name space
aMail =
oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem)
oInsp = aMail.GetInspector
cbStandard = oInsp.CommandBars("Standard")
cbb = cbStandard.FindControl(Tag:="aButton")
session = oApp.Session
'check to see if button exists
If Not cbb Is Nothing Then
Exit Sub
' create button first time though
Else
cbb = cbStandard.FindControl(id:=2617)
test = cbb.Caption
aButton = cbStandard.Controls.Add(1, before:=cbb.Index + 1)
With aButton
.Caption = "Send and File"
.Style = MsoButtonStyle.msoButtonCaption
.Tag = "aButton"
.Visible = True
.OnAction = "!<" & addInInst.ProgID & ">"
End With

End If

End Sub
 
Top