Example Code

Programmatically Copy And Paste Data Within An Excel Sheet

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

  • LabVIEW

Code and Documents

Attachment

Overview

This example demonstrates how to programmatically copy and paste data within an Excel sheet.

 

Description

This VI copies existing data from an Excel sheet and pastes that data to another location within the sheet. The range can be a single cell or a collection of cells designated by the [Column Letter][Row Number]: [Column Letter][Row Number] format used by Excel. The copied data is pasted with the same formatting as the source data.

 

Requirements

 Software

  • LabVIEW Base Development System 2012 (or compatible)
  • Microsoft Excel 2016 (or compatible)

 Hardware

  • No hardware is necessary to use this example VI

 

Steps to Implement or Execute Code

  1. Download and open the attached ZIP-file
  2. Open the Test.xls file with Excel
  3. Open and run the [Main]...VI

 

Additional Information or References

Programmatically Copy and Paste Data in Excel - Front Panel.png

 

Programmatically Copy and Paste Data in Excel - Block Diagram.png

 

Note: You cannot use this example on RT targets. ActiveX is a Windows only technology and not available on RT targets.

 

**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text ‘NIVerified’. Read here for more information about the new Example Guidelines and Community Platform.**
Donovan

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

Comments
DianeMart1
Member
Member
on

Exactly what I was looking for! Thank you very much!