LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Open a MS Excel File

Solved!
Go to solution

Hi,

I have an Excel generated after some calculations in LabVIEW exe. I just want to open that excel file after the process is finished. So that the operator can see the end results.

I tried some exiting ActiveX examples but failed. Do I need to install some libraries to use the excel activeX.

0 Kudos
Message 1 of 5
(3,395 Views)

I have some questions:

  • You describe "an Excel" generated after some calculations in "LabVIEW exe".
    • What, specifically, is generated?  Is it a Text file with the extension .csv (which might have an "Excel-appearing" Icon), or is it a .xls or .xlsx file that is in Excel's proprietary file format?
    • How are the files really generated?  Do you open LabVIEW and run one or more VIs?  Or do you run an Application (.exe) that was originally built by LabVIEW?
  • You want to open the Excel file after the process is finished.
    • Have you stopped the previous program that generated the file?  If so, you can simply open Excel and "point it" at the just-created file.
    • Are you trying to write LabVIEW code that works as part of the LabVIEW code that generated the Excel file, or is this LabVIEW code that runs "stand-alone" after you generate the data?

     The "simple" answer to what you describe (and hinted at two bullet points above) is to simply close LabVIEW and open Excel.  But if you are extending existing LabVIEW code, then you need to do the following:

  1. Find the Folder that contains the LabVIEW code generating the data file.  With a little bit of luck, it will include a LabVIEW Project and a few additional VIs, but maybe not.
  2. Compress this folder (which generates a .zip file) and attach that file to your Reply to the questions asked above.  We can then look at the code to better understand what has been done, and make sensible suggestions (as opposed to "guesses").

Bob Schor

0 Kudos
Message 2 of 5
(3,380 Views)

https://forums.ni.com/t5/Example-Programs/Open-a-PDF-File-using-command-line-using-LabVIEW/ta-p/3505...

Will this work? Just a command to open file in default application, the same as you double click in explorer

 

0 Kudos
Message 3 of 5
(3,371 Views)

I agree with Alexander.  ActiveX is not required in order to simply open a file in the default application.  Even if your output file is a CSV file (as mentioned by Bob), that file extension typically defaults to opening with Excel, assuming you have Excel installed on this machine. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 4 of 5
(3,368 Views)
Solution
Accepted by topic author himanshu25

If you don't mind using System Exec.vi then this code example will open excel with the file whose path you provide.

ExcelSnippet.png

Message 5 of 5
(3,363 Views)