Private Sub AddEmailPhoneType()
''This is an example of adding an email address "phone" type available on the UI as Config > Tables > Phone 

''Using the IBBTableLookupHandler2 as the Extension to the CTableLookupHandler class
''This was introduced in RE 7.94

Dim oTables As CCodeTables
Set oTables = New CCodeTables
oTables.Init REApplication.SessionContext

Dim reservice As REServices
Set reservice = New REServices
reservice.Init REApplication.SessionContext

Dim oCodeTableServer As CCodeTablesServer
Set oCodeTableServer = reservice.CreateServiceObject(bbsoCodeTablesServer)
oCodeTableServer.Init REApplication.SessionContext

Dim oTablelookupHandler As CTableLookupHandler
Set oTablelookupHandler = reservice.CreateServiceObject(bbsoTableLookupServer)
oTablelookupHandler.Init REApplication.SessionContext

Dim oTableLookupExt As IBBTableLookupHandler2
Set oTableLookupExt = oTablelookupHandler

Dim oTable As CCodeTable
Dim lID As Long
'Loop through the tables to find the one you need
    For Each oTable In oTables
        If oTable.Fields(ctfNAME) = "Phone Types" Then
        'Get the ID
        lID = oTable.Fields(ctfCODETABLEID)
    Exit For
        End If

Next oTable
Set oTables = Nothing
Set oTable = Nothing

'Load the collection of table entries for the requested table
Dim oTEs As CTableEntries
Set oTEs = New CTableEntries
oTEs.Init REApplication.SessionContext, lID

'Get a count of table entries
Debug.Print oTEs.Count

Dim oTE As CTableEntry

Dim Success As Boolean
Dim sEmail As String
sEmail = "Email Test"

If oCodeTableServer.GetTableEntryID(sEmail, lID) = 0 Then
omsgbox = MsgBox("Do you want to add '" & sEmail & "' to the " & _
oCodeTableServer.TABLENAME(lID) & " table?", vbYesNo)

Select Case omsgbox
Case vbYes
With oTableLookupExt
    'AddPhoneEntry function - Adds a new phone entry to the lookup table.
    'staticentryPhoneTypeTelephoneNumber=1 (default)
    .AddPhoneEntry True, sEmail, 3 ''Description=Email Test, Phone number type=Email Address
End With
Case vbNo
    Debug.Print "Nothing"
End Select

End If

Set oTEs = Nothing
Set oTE = Nothing
Set oCodeTableServer = Nothing
Set oTablelookupHandler = Nothing
Set oTableLookupExt = Nothing
Set reservice = Nothing

End Sub

Disclaimer: We provide programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes you are familiar with Microsoft Visual Basic and the tools used to create and debug procedures. Our Customer Support can help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality. If you are interested in learning more about the VBA and API modules, contact your account manager.