Add the new button.Set cbbAddIn = _
cbrMenu.Controls.Add(Type:=msoControlButton, _
Parameter:=”Rename Form Controls”)Set the button’s Caption, Tag, Style, and OnAction properties.With cbbAddIn
.Caption = “Rename &Form Controls”
.Tag = “Rename Form Controls”
.Style = msoButtonCaptionRun the main add-in function..OnAction = PROG_ID_START & AddInInst.ProgId _
& PROG_ID_END
End With
End IfOn Error GoTo ErrorHandlerReturn a reference to the new command bar button.Set CreateFormCommandBarButton = cbbAddInErrorHandlerExit:
Exit FunctionErrorHandler:
AddInErr Err
Resume ErrorHandlerExitEnd FunctionPublic Function CreateReportCommandBarButton(ByVal _
Application As Object, ByVal ConnectMode As _
AddInDesignerObjects.ext_ConnectMode, _
ByVal AddInInst As Object) As Office.CommandBarButtonOn Error GoTo ErrorHandlerStore a reference to the Application object in a public variable so other procedures in the add-in
can use it.Set pappAccess = ApplicationPart III Adding More Functionality to Office