Create a new component

Public Function NewComponent(compName As String, _
        ParentFolder As ComponentFolder) _
    As Component

    Dim myComp As Component
    Dim compFactory As ComponentFactory
    On Error GoTo NewComponentErr
    ' Get a ComponentFactory
    Set compFactory = ParentFolder.ComponentFactory
    ' Add the component
    Set myComp = compFactory.AddItem(Null)
    Dim errString As String
    If (compFactory.IsComponentNameValid(compName, errString)) Then = compName
    Else = "DefaultValidName"
        MsgBox errString
    End If
    Debug.Print CStr(myComp.Field("CO_FOLDER_ID"))
    'Return the new component.
    Set NewComponent = myComp
Exit Function
    MsgBox err.Description
End Function