LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pop up saying File already exists when saving an excel file while running exe

I have an excel file which I read and write in my application.

When I run the application in development system, it works fine. However when I run the application as an exe and try to save the excel file, it says that 'The file already exists and Do you want to replace?'.

 

Why does this question asked for exe?

PFA my write excel VI

 

Thanks in advance.

0 Kudos
Message 1 of 2
(2,966 Views)

Hi Princess_swa,

 

The problem may be that when you build an exe, it adds another folder called 'builds' into the filepath.

A good way to fix this is to create a case structure, putting extra strip paths into your filepath if running an exe.

 

I have attached a screenshot of my code doing exactly this for you to look at. The code creates a 'base path' which is then used to reference all of my file paths in my code - and therefore, they will always have the right number of strip paths when it is run. (Note: in my code I have 2 extra strip paths, due to where I've placed the folder, but one should be sufficient.)

 

 

Also there is a 'Check if folder exists' VI which you can again link to a case structure, and change the filename if it already exists. Again, I have provided a screenshot of my code which does this.

 

Hope this helps,

Lou

Download All
0 Kudos
Message 2 of 2
(2,890 Views)