Access.2007.VBA.Bibl..

(John Hannent) #1
ErrorHandler:
AddInErr Err
Resume ErrorHandlerExit

End Sub

Private Sub frmcbb_Click(ByVal ctl As _
Office.CommandBarButton, CancelDefault As Boolean)

On Error Resume Next

Call LNCRenameFormControls

End Sub

Private Sub rptcbb_Click(ByVal ctl As _
Office.CommandBarButton, CancelDefault As Boolean)

On Error Resume Next

Call LNCRenameReportControls

End Sub

Public Function CreateFormCommandBarButton(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

Return a reference to the command bar..


Set cbrMenu = pappAccess.CommandBars(“Form Design”)

Add a button to call the add-in from the command bar, if it doesn’t already exist.


Look for the button on the command bar.


Set cbbAddIn = _
cbrMenu.FindControl(Tag:=”Rename Form Controls”)

On Error Resume Next
If cbbAddIn Is Nothing Then

Creating COM Add-ins with Visual Basic 6 13

Free download pdf