automation server

I have a activex control (.dll) that I have registered and am now trying to use it in Navision. It appears in the list of automation servers and all its methods and properties are visible. My problem is actually using it. Whenever I try to create an instance of it I get the message: “Could not create an instance of the OLE control or automation server identified by…” “Check that it is correctly installed and registered.” I know of only one way to register a control on NT and that seems to work just fine (regsvr32). Does anyone have anysuggestions or is there some additional documentation on this topic (other than the application designer’s guide)? Thanks for any help.

Look for the error in your code! Let’s take the following Excel-Example: You want to create a new worksheet ‘TEST’:


Workbooks := Application.Workbooks;
Workbook := Workbooks.Add;
Worksheet := Workbook.ActiveSheet;
Worksheet.Name := 'Test';
Worksheet.Activate;

This code will fail with exactly the same error message as it fails to create an instance of the application object (Excel in this case. The following would work:


IF CREATE (Application, FALSE) THEN begin
  Workbooks := Application.Workbooks;
  Workbook := Workbooks.Add;
  Worksheet := Workbook.ActiveSheet;
  Worksheet.Name := 'Test';
  Worksheet.Activate;
END;

The code is based on following declarations:


Application	Automation	'Microsoft Excel 10.0 Object Library'.Application	
Workbooks	Automation	'Microsoft Excel 10.0 Object Library'.Workbooks	
Workbook	Automation	'Microsoft Excel 10.0 Object Library'.Workbook	
Worksheet	Automation	'Microsoft Excel 10.0 Object Library'.Worksheet	

As you can see in the first line of the first example …

Workbooks := Application.Workbooks;

… I’m trying to assign the default Woorkbooks object of the Application )= Excel in this case) to the variable “Workbooks”. This fails as the Variable “Application” is not instantiated at this moment. In the second example it will work as the CREATE (Application) command openes excel and returns an Application-Pointer to Excel. Hope this helps With best regards from Switzerland Marcus Fabian Edited by - fabian on 2002 Jan 28 03:48:49

Marcus, Thanks very much for your reply, but that’s exactly what I’m doing. It fails on the create. Is there a way or a list of possibilities as to why the create would fail?

you may have multiple versions of the dll in the registry. On the automation list do you see one entry for your dll or multiple lines with different versions? If there’s more than one line do a unregister on all versions (using the registry if you can). Try testing the dll in the development environment it was created for e.g VB, make sure it works before coding it in navision. If it still doesnt work! email me your dll project. Brian Santos pauljose@symaptico.ca Edited by - brians on 2002 Jan 29 14:10:00

I wasn’t properly specifying the automation server subtype. As soon as I did that it worked fine.

Hi David, when you are using an Active X Control, so you must define it as OCX Datatype and not as an Automation Datatype. Any kind of OCX vars you don’t must instantiate with the CREATE comand, because is just instantiated when you make the first reference to the var. With best regards

Hi David, I guess it’s time that you tell us what dll you are referring to. Does it contain visual components (which NF does not support) ? With best regards from Switzerland Marcus Fabian