Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Tutorial
NI Supported: Yes
Publish Date: Sep 6, 2006

Using LabVIEW as an Automation Client with Microsoft Excel

8 ratings | 1.50 out of 5
Print

Description

You can use LabVIEW to communicate with Microsoft Excel via ActiveX automation. LabVIEW acts as the automation client and Excel acts as the automation server. Excel exposes numerous objects such as workbooks, worksheets, charts, and ranges of cells that you can access from the automation server. From LabVIEW, you are able to manipulate only the objects that Excel exposes to other applications. This means that Excel determines what it exposes and what values and variables must be passed to each method or property.

Manipulating Excel via automation requires you to have knowledge of the Excel object model as well as familiarity with performing ActiveX automation from LabVIEW. The best source of information about the Excel Object Model is the Excel Object Model Help file located on your Microsoft Office CD. For Office 97, this file is called Vbaxl8.hlp. Additionally, the Microsoft Object Model Guide details the organization of the objects in Excel as well as Access, Word, and PowerPoint. The basic procedure for communicating with Microsoft Excel through LabVIEW is to open a reference to Excel from LabVIEW, invoke methods and set/get properties, and then close the reference. Notice that since Excel allows you to open references to difference objects in its hierarchy, you must close each one individually.

In LabVIEW 7.1 or earlier, refer to the ActiveX Support chapter of the LabVIEW User Manual (linked below) for more information about using ActiveX in LabVIEW. In LabVIEW 8.0 or later, refer to the Using ActiveX with LabVIEW topic in the LabVIEW Help (linked below).

Common Applications


Multiple uses include loading a spreadsheet, exporting data from LabVIEW to an existing Excel spreadsheet, and graphing data in Excel programmatically.
Related Links:
LabVIEW User Manual
LabVIEW Help: Using ActiveX with LabVIEW
8 ratings | 1.50 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).