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 applicationObject = CType(application, EnvDTE.DTE) addInInstance = CType(addInInst, EnvDTE.AddIn) If connectMode = Extensibility.ext_ConnectMode.ext_cm_UISetup Then Dim objAddIn As AddIn = CType(addInInst, AddIn) Dim CommandObj As Command Try CommandObj = applicationObject.Commands.AddNamedCommand(objAddIn, "LetsTestAddins", "LetsTestAddins", _ "Executes the command for LetsTestAddins", True, 59, Nothing, 1 + 2) _ '1+2 == vsCommandStatusSupported+vsCommandStatusEnabled CommandObj.AddControl(applicationObject.CommandBars.Item("Tools")) m_objDTE = CType(application, EnvDTE.DTE) m_objCommandBarButton = _ m_objDTE.CommandBars.Item("GROOVYADDIN").Controls.Add(MsoControlType.msoControlButton) ' Set properties m_objCommandBarButton.Caption = "YourCaption" m_objCommandBarButton.TooltipText = "My ToolTip" Catch e As System.Exception End Try End If End Sub Private Sub m_objCommandBarButton_Click(ByVal Ctrl As Microsoft.Office.Core.CommandBarButton, _ ByRef CancelDefault As Boolean) Handles m_objCommandBarButton.Click MsgBox("Your code here...") End Sub>Hi Joe,
"If ye love wealth better than liberty, the tranquility of servitude better than the animated contest of freedom, go home from us in peace. We ask not your counsel or arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
~Samuel Adams