/ Forums / Advansys Formativ / Formativ Creator / Using OCX with formativ / Reply To: Using OCX with formativ
February 6, 2007 at 3:39 pm
#5562
Thank you for your enquiry.
An OCX is a COM component/object, which must be used in the same way with any scripting language. The component’s ProgID is used to create an instance; eg. if your OCX is “AllenKey”, implemented in the file AcmeTools.OCX, the ProgId might be “AcmeTools.AllenKey”.
Here is a sample VBScript function to create and return an instance of the Microsoft Word Application object:
function OpenWord dim iName dim oDoc dim oResult ' GetObject (below) will raise an error if Word is not running, ' so suppress normal error handling. on error resume next ' Initialize oResult so we have a value to compare later. set oResult = nothing ' Attempt to reference a running Word instance. set oResult = GetObject(, "Word.Application") if Err.Number <> 0 then call Err.Clear end if if oResult is nothing then ' Create an instance of the Word application. set oResult = CreateObject("Word.Application") end if set OpenWord = oResult end function
I hope this helps you.
Regards,
Advansys Support