Accessing an ActiveX-Enabled Application
- Updated2025-04-01
- 2 minute(s) read
To access an ActiveX-enabled application in LabVIEW, complete the following steps:
- Add an automation refnum control to the front panel of a VI.
- Select an ActiveX class for the automation refnum control to specify the ActiveX object you want to access.
- Use the Automation Open function on the block diagram to open the reference to the ActiveX object. When you open the reference, you enable LabVIEW to communicate with the referenced ActiveX object.
- Pass the reference to a Property Node or an Invoke Node to access properties or invoke
methods on the object. When you click one of these nodes, LabVIEW displays all of the
properties or methods available for the object. The object implements the Component Object
Model (COM) interface, which determines the available properties and methods. Note If LabVIEW does not display the properties or methods that you expect for a particular ActiveX object, the object might implement multiple COM interfaces. LabVIEW can display the properties or methods from only one COM interface implemented by an object at a time. You can force LabVIEW to display the properties and methods from a different COM interface that the object implements by using the Variant To Data function to cast the object to the other COM interface.
- Use the Close Reference function to remove the object from memory.
You can use the previous steps to access common ActiveX enabled applications, such as Microsoft Office applications. For example, Microsoft Excel is an ActiveX-enabled application. You can open a reference to Excel and call properties and methods that open Excel so it appears on the user screen, create a workbook, create a spreadsheet, and write a table from LabVIEW to the Excel spreadsheet.
Refer to the Excel - Write Table VI in the labview\examples\Connectivity\Excel directory for an example of using LabVIEW as an Excel client.
Note Applications that include ActiveX custom interfaces appear with a
icon. Click the icon to select an object for the custom interface.
