Access.2007.VBA.Bibl..

(John Hannent) #1
The AccessDesigner code is listed next, with the specific modifications needed to implement the
add-in’s functionality, using the event procedures supported by the IDTExtensibility2 library to cre-
ate command bar buttons, and assign procedures to them. The module also contains the proce-
dures used to do control renaming:

Implements IDTExtensibility2

Private WithEvents frmcbb As Office.CommandBarButton
Private WithEvents rptcbb As Office.CommandBarButton

Global variable to store reference to host application (Access)

Public pappAccess As Access.Application

Regular variables for creating toolbar buttons

Private cbrMenu As Office.CommandBar
Private cbbAddIn As Office.CommandBarButton

Public variables for handling renaming

Public pctl As Access.Control
Public pdbs As DAO.Database
Public pfrm As Access.Form
Public pintRenameFail As Integer
Public pintReturn As Integer
Public plngControlType As Long
Public prpt As Access.Report
Public prst As DAO.Recordset
Public pstrMessage As String
Public pstrNewCtlName As String
Public pstrOldCtlName As String
Public pstrSQL As String
Public pstrSourceObject As String

Private variables for handling renaming

Private i As Integer
Private blnTag As Boolean
Private intTag As Integer
Private strPrefix As String
Private blnUnbound As Boolean
Private strControlSource As String
Private strCaption As String
Private strObjectName As String
Private strCtlName As String

Part III Adding More Functionality to Office

Free download pdf