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 = msoButtonCaption
Run the main add-in function.
.OnAction = PROG_ID_START & AddInInst.ProgId _
& PROG_ID_END
End With
End If
On Error GoTo ErrorHandler
Return a reference to the new command bar button.
Set CreateFormCommandBarButton = cbbAddIn
ErrorHandlerExit:
Exit Function
ErrorHandler:
AddInErr Err
Resume ErrorHandlerExit
End Function
Public Function CreateReportCommandBarButton(ByVal _
Application As Object, ByVal ConnectMode As _
AddInDesignerObjects.ext_ConnectMode, _
ByVal AddInInst As Object) As Office.CommandBarButton
On Error GoTo ErrorHandler
Store a reference to the Application object in a public variable so other procedures in the add-in
can use it.
Set pappAccess = Application
Part III Adding More Functionality to Office