Depending on how the type library of an ActiveX component is set up, a property can be returned to Visual LANSA as type IDispatch instead of a specific type. With the IDispatch interface the properties, events and methods of the object will only be resolved at run-time. For example the Worksheet object in Excel is of type IDispatch.
Because the type of the object is not known, statements using its properties, events and methods will return an error "Component IDispatch does not contain property/method/event X". For example this statement will cause the error:
So, in order to use an object of type IDispatch interface, you must first define the object with a dynamic reference and then explicitly set the reference to it. Only then can you use the object's properties, methods and events.
For example to activate an Excel worksheet, you need to first define it:
Define_Com Class(#VA_EXCEL.Worksheet) Name(#WorkSheet) Reference(*Dynamic)
Then in your code set the reference to it:
Set_Ref Com(#Worksheet) To(*Dynamic #Excel.Worksheets.Item<'blad2'>)
And only then use the Activate method:
The F2 help will show you that the type of the object is IDispatch interface. To find out the actual type of the object, refer to whatever documentation is provided with the ActiveX control.