Save an Excel Document Without Prompting for a File Path or Displaying a Warning

Updated Dec 18, 2023

Environment

Software

  • LabVIEW Full
  • LabVIEW Professional

Operating System

  • Windows

Other

Microsoft Office Excel

How do I programmatically tell Excel to save a document, but not to prompt me for the file path or warn me that I'm overwriting the existing file?

If you are using the Report Generation Toolkit:
Use the Save Report to File.vi, located in Functions » Report Generation palette. This VI requires a report reference input for the Excel Report that you want to save. It also requires a report file path input containing the location and filename of the report you want to save. This will not prompt for a file path or overwrite.

If you are not using the Report Generation Toolkit:
Microsoft provides an ActiveX method that you can modify to disable the prompts when saving your Excel document.
  1. After opening a reference the Excel application using Automation Open, create a new property node
  2. Add an element to the property node and select DisplayAlerts. Connect a Boolean false constant to this element (see the screenshot below)

Figure 1: Setting the DisplayAlerts property
 
For examples of using ActiveX to interface with Microsoft Excel, review the Excel examples available in the NI Example Finder that ships with LabVIEW:
  1. From any LabVIEW Window, select Help » Find Examples...
  2. In the Search tab, enter excel to find the examples