Example Code

How to Create a New Microsoft Excel Worksheet in LabWindows/CVI

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabWindows/CVI

Code and Documents

Attachment

Download All

Description

Overview
This example demonstrates how to create a new worksheet in Microsoft Excel with C programming in LabWindows/CVI.

 


Description
Using the ExcelRpt_ApplicationNew, ExcelRpt_WorkbookNew and ExcelRpt_WorksheetNew functions in the Excel Reports Library, Microsoft Excel can be programmatically opened and a new Worksheet can be created. This example contains a user interface to allow the user to choose when Microsoft Excel is opened and when a new worksheet is created.

The Excel Reports Library is available as a part of LabWindows/CVI. The function panels can be found under C:\Program Files\National Instruments\<CVI DIR>\toolslib\activex\excel.

Relative Links: Generating Microsoft Excel Reports with LabWindows™/CVI™

 


Requirements

  • LabWindows/CVI 2012 (or compatible)


Steps to Implement or Execute Code

  1. Unzip the attached folder to your computer
  2. Create 3 command buttons on the User Interface (Launch Excel, New Sheet, Quit)
  3. Create callbacks for each of these buttons
  4. Use ExcelRpt_ApplicationNew and ExcelRpt_WorkbookNew to open up Microsoft Excel with a new Workbook for the Launch Excel callback
  5. Use ExcelRpt_WorksheetNew to create a new sheet for the New Sheet callback
  6. Quit the user interface and discard the panel in the Quit callback

 

Additional Information or References
Front Panel

 Front Panel.jpg

 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

 

Applications Engineer
National Instruments

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

Comments
theoMartin
Member
Member
on

Hello,

I am very interrested by this example but when I am trying compiling it, I have thoses errors :

     Undefined symbol '_ExcelRpt_WorksheetNew@12' referenced in "excelreportdemo.c".

     Undefined symbol '_ExcelRpt_ApplicationNew@8' referenced in "excelreportdemo.c".

     Undefined symbol '_ExcelRpt_WorkbookNew@8' referenced in "excelreportdemo.c".

Did someone have a solution about this problem?

scottrod
Member
Member
on

ExcelRpt_WorksheetNew et al. no longer exist apparently in the referenced demo.