Encrypt and Decrypt Excel File with Password in LabVIEW

Updated Sep 25, 2024

Environment

Software

  • LabVIEW

Other

  • Microsoft Excel

This article outlines the method to encrypt and decrypt Excel file with password in LabVIEW.

1. Launch LabVIEW and create a New VI.

2. Create the block diagram of the VI, as shown in the diagram below.

Encrypt and decrypt Excel file.png
Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.

a) You can specify Password parameter in Workbooks.Open method (Excel) to open a password protected workbook.
b) You can use Workbook.Password property (Excel) to set the password for the specified workbook.
c) To properly access LabVIEW ActiveX built in functions, please use LabVIEW 32-bit with Microsoft Office 32-bit , or, LabVIEW 64-bit with Microsoft Office 64-bit. For more information, please refer to Cannot Access Methods or Properties for Microsoft Office ActiveX References.

3. Configure the file path and input strings to encrypt and decrypt Excel file with password.

4. Run the VI.
 

After running the VI, you will find out that the specified Excel file is password-protected.
Password-protect Excel file.png