I am not able to open the Scripted component(created through code) in QC - BPT

I am creating a scripted component in QC using the code given below.

The component is getting created in QC and I am able to do other tasks like adding parameters.

When I try to open the Scripted component in QTP it shows the Components Tree with the newly create Component and when I select component and try to open it gives an error saying the particular conponent does not exist.

I am using QTP 9.2 and QC 9.2

Function NewComponent(strCompName,strParentFolderPath )
Dim objNewComponent
Dim objCompFactory

Set objCompFldrFactory = QCUtil.QCConnection.ComponentFolderFactory
Set ParentFolder = objCompFldrFactory.FolderByPath(strParentFolderPat h)

Set objCompFactory = ParentFolder.ComponentFactory

' Add the component
Set objNewComponent = objCompFactory.AddItem(Null)

If (objCompFactory.IsComponentNameValid(strCompName," ")) Then
objNewComponent.Name = strCompName
'Invalid Component name
'Err.raise 999,"Invalid component name"
End If
objNewComponent.ApplicationAreaID = 99 'Hard coded for the time being
objNewComponent.ScriptType = "QT-SCRIPTED"

'Return the new component.
Set NewComponent = objNewComponent
If err.Number <> 0 then
MsgBox Err.Description & "******" & Err.Number
End If
End Function