This procedure removes the command bar buttons for the add-in if the user disconnected it.On Error Resume NextIf 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 ThenDelete the custom command bar buttons.With pappAccess.CommandBars(“Form Design”)
.Controls(“Rename Form Controls”).Delete
End WithWith pappAccess.CommandBars(“Report Design”)
.Controls(“Rename Report Controls”).Delete
End With
End IfErrorHandlerExit:
Exit FunctionErrorHandler:
AddInErr Err
Resume ErrorHandlerExitEnd FunctionPublic Function LNCRenameFormControls() As VariantRenames all the controls on open forms.On Error Resume NextGenerate table of control types to use in renaming controls (if it does not already exist).CreateCTTableOn Error GoTo ErrorHandlerDetermine whether any forms are open, and exit if not.If pappAccess.Forms.Count = 0 Then
MsgBox “No forms are open; exiting”
GoTo ErrorHandlerExit
End IfPart III Adding More Functionality to Office
