Access.2007.VBA.Bibl..

(John Hannent) #1
This procedure removes the command bar buttons for the add-in if the user disconnected it.

On Error Resume Next

If the user unloaded the add-in, remove the button. Otherwise, the add-in is being unloaded
because the application is closing; in that case, leave button as is.

If RemoveMode = ext_dm_UserClosed Then

Delete the custom command bar buttons.

With pappAccess.CommandBars(“Form Design”)
.Controls(“Rename Form Controls”).Delete
End With

With pappAccess.CommandBars(“Report Design”)
.Controls(“Rename Report Controls”).Delete
End With
End If

ErrorHandlerExit:
Exit Function

ErrorHandler:
AddInErr Err
Resume ErrorHandlerExit

End Function

Public Function LNCRenameFormControls() As Variant

Renames all the controls on open forms.

On Error Resume Next

Generate table of control types to use in renaming controls (if it does not already exist).

CreateCTTable

On Error GoTo ErrorHandler

Determine whether any forms are open, and exit if not.

If pappAccess.Forms.Count = 0 Then
MsgBox “No forms are open; exiting”
GoTo ErrorHandlerExit
End If

Part III Adding More Functionality to Office

Free download pdf