Example Code

Using LabVIEW and ActiveX to Perform Basic Tasks In Microsoft Excel

Code and Documents

Attachment

You can use this VI to see the similarities between Active X calls made by a macro recorded in Microsoft Excel and those made in LabVIEW.

This VI creates a new workbook in Excel, selects cell 5 in Sheet1, inserts the words "Hook 'em", and sets the width of column C to 20. On the block diagram, this VI includes a screenshot of a VB script that was created by recording a macro in Excel.

This example shows how easy it is to automate Excel from LabVIEW. To perform an Excel task from LabVIEW, record a macro, manually perform the task, and examine the methods and properties that the macro uses. The methods and properties that are used should be the same as the ones used by LabVIEW or any other ActiveX client.


Related Links:
Microsoft COM Technologies
ActiveX/COM Overview

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors