Access.2007.VBA.Bibl..

(John Hannent) #1
!ControlType = 122
!ControlTypeName = “Toggle Button”
.Update
.AddNew
!ControlType = 123
!ControlTypeName = “Tab Control”
.Update
.AddNew
!ControlType = 124
!ControlTypeName = “Page”
.Update
.Close
End With

ErrorHandlerExit:
Exit Function

ErrorHandler:
If Err.Number = 3010 Then

Control types table already exists.

Exit Function
Else
AddInErr Err
Resume ErrorHandlerExit
End If

End Function

Creating the DLL ..........................................................................................

After modifying the code in the SharedCode and AccessDesigner modules as needed, save the project
with a meaningful name (I named the sample COM add-in “LNC Control Renaming”). The project
name will also be used as the name of the DLL file when you make that file. The final step is creating
the add-in’s DLL by selecting File, Make Project Name.dll (with the actual project name replacing the
“Project Name”). If there are any syntax errors in the project, you will get an error message at this
point, and you can correct the errors and try again, until the DLL is successfully created.

To rename a VB project, select the project (the top line in the Project Explorer) and
modify its name property in the properties sheet. To modify a Designer’s name, open it,
then select it and modify its name in the properties sheet. The name you give a VB project is the one
that will be used by default when creating a DLL.

Installing a COM Add-in ........................................................................................


If you copy the DLL file created by a COM add-in to the default Add-ins folder (usually C:\Documents
and Settings\User Name\Application Data\Microsoft\AddIns), its button(s) should automatically appear
in the Toolbar Commands group of the Add-Ins tab of the Ribbon (as shown in Figure 13.8); at least
if you are running Windows XP.

TIPTIP


Creating COM Add-ins with Visual Basic 6 13

Free download pdf