LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can't find file in error in exe, but works in development environment

I have LabVIEW 6.1 and the Report Generation Toolkit 1.0. I use the New Report VI to create a new report based on an Excel template. The VI functions correctly in the LabVIEW development environmnet, but I get an Error 7 when I run the executable (built) file. I have my top level VI and have included the correct support files (_exclsub.llb and _wordsub.llb) in the data subdirectory. My file path is an absolute path hard coded in my VI. I even tried creating a dialog box to specify the file path and that also does not work. Any help would be greatly appreciated.
0 Kudos
Message 1 of 5
(3,191 Views)
When in the executable environment there is an extra strip that needs to be done to get the absolute path. For example say your files are located in C:Temp. Your vi name is test.vi. So using the Current vi's Path function inside of test.vi you will see a path of C:Temp\test.vi. If you were to compile this into an executable you would see C:Temp\test.exe\test.vi. So to get the base path you can use the strip path function twice. This is also the case in a DLL created in LV. Hope this helps.
BJD1613

Lead Test Tools Development Engineer

Philips Respironics

Certified LV Architect / Instructor
Message 2 of 5
(3,191 Views)
I'm still strugling with this concept. My file is only an Excel template file. I don't see how the location of my executable file effects the location of the excel template when the location is hard coded. For example, my template file is located in C:\LV Support Files\torque template.xls. It just seems to me it would not matter where the exe file is located, because the complete path to template file is given (hard coded). Am I missing something? Thanks for your help.
0 Kudos
Message 3 of 5
(3,191 Views)
You are correct this shouldn't affect that opening of an excel template or writing to the template. How are you doing this in your code?
BJD1613

Lead Test Tools Development Engineer

Philips Respironics

Certified LV Architect / Instructor
0 Kudos
Message 4 of 5
(3,191 Views)
I wire the path constant (C:\LV Support Files\torque template.xls) to the input of the new report vi. I've also tried making the template path a control and when the VI runs I manually point to the template file, in order to make sure the vi finds the file. The executable still has the error 7 (file not found).
0 Kudos
Message 5 of 5
(3,191 Views)