Add an existing site user to the connected project
Sub AddProjectUser (NewProjectUser$, addToUserGroup$)
    
' Add an existing site user to the connected project

 
    Dim CustUsersGroups As CustomizationUsersGroups
    Dim CustGroup As CustomizationUsersGroup


' Get customization data into the local cache.
' Customization Object.
    'tdc is the global TDConnection object.
    tdc.Customization.Load

'The  AddUser method adds a user to a project but not to the site.
' Therefore, if you restart the server, the user disappears.
'Define the site user before using the AddUser method.
'Either use the Site Administration UI or create the site
'  user in code:
'tdc.Customization.Users.AddSiteUser "Cheng", _
'    "Cheng Ivanovitz Smith", _
'    "Cheng@Pemberley.com", _
'    "Description of Cheng", _
'    "614-666-1234", _
'    "QATester"

'Add user to the project with the CustomizationUsers Object
' referenced through TDConnection.Customization.Users.
    tdc.Customization.Users.AddUser NewProjectUser


' Add the new user to a user group.
    
    Set CustUsersGroups = tdc.Customization.UsersGroups

    'addToUserGroup is a group name, for example "QATester"
    Set CustGroup = CustUsersGroups.Group(addToUserGroup)
    ' Add the user.
    CustGroup.AddUser NewProjectUser
    
' Commit the changes to the project.
    tdc.Customization.Commit


End Sub