Hi,
I wanted to load the .ocx controls at runtime and call its methods during runtime.
I was able to load the control at runtime but not able to set its methods and subroutines.
Here is the code snippet:

Dim WithEvents objEcg As VBControlExtender
Private Sub Form_Load()
Set obj = Controls.Add("ProgID.OCXCtrl", "ocx1", Frame1)
obj.Visible = True
obj.WebURL = "URLPath"
obj.Height = 375
obj.Left = 120
obj.Top = 240
obj.Width = 300
Call obj.methodOnOCX("strparam1", "strparam2")
End Sub

Note: methodOnOCX is a subroutine with signature as methodOnOCX(str1 as String,str2 as String)

Error on calling the function is: "Object variable or with block variable not set"

Note: I am able to set all the properties of the control and view them during runtime.

Any help is appreciated.
Thanks