共用方式為


Automation Data Type

Use the Automation data type to reference an automation server.

To use an automation server in Microsoft Dynamics NAV

  1. Define a variable of type Automation and give it a name.

  2. Select the Subtype field, and in the Automation Object List window that opens, in the Automation Server field, get a list of available automation servers.

  3. Select a server and then choose the OK button.

    In the Automation Object List the interfaces of the selected automation server are displayed.

  4. Select an interface and then choose the OK button.

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:

'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 Microsoft Dynamics NAV.

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:

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.

Limitations

  • Automation is not supported by Microsoft Dynamics NAV Web client.

  • Automation objects cannot run on Microsoft Dynamics NAV Server.

See Also

Reference

CREATE Function (Automation)
ISCLEAR Function (Automation)
Variant Data Type