Use the Automation data type to reference an automation server. In order to use an automation server in C/SIDE, define a variable of type Automation and give it a name. Next, click the AssistButton in the Subtype field. In the Automation Object List form that opens, use the AssistButton in the Automation Server field to get a list of available automation servers. Select a server and then click OK. When the lookup form closes, the table part of the Automation Object List form is filled in with the interfaces of the selected automation server. Select an interface and then click OK.

This procedure has selected the GUID of the automation server, the version number, and the GUID of the interface. It is immediately evaluated into a name such as <name of server>.<name of interface>, as in the following:

  CopyCode imageCopy Code
'Microsoft Excel X.0 Object Library'.Application

When you have defined an automation server as a variable, you must use CREATE Function (Automation) to create an instance of the server. After that, you can use the server through the variable. You can browse its methods and properties in the Symbol menu.

When you are using a server, you should know that there is not a one-to-one relationship between C/AL data types and COM data types. For an overview of the data type mapping, see Using COM Technologies in C/SIDE.

C/SIDE can receive events from an automation server.

If you use a variable of type Automation to automate Microsoft Excel and you run an English (United States) version of Excel but the regional settings for the computer are configured for a non-English language, then you will receive the following error:

  CopyCode imageCopy Code
Error: 0x80028018 (-2147647512)
Description: Old Format or Invalid Type Library 

For more information, see Microsoft Help and Support article 320369: BUG: "Old format or invalid type library" error when automating Excel.

Expand imageSee Also