08-02-2023 02:10 PM
Hello,
I am trying to create reports in Excel using data collected from my application. When I run the main VI from the project environment I get no errors. However, after building the application and running the EXE I get the error below:
This occurs after I open the template file, save as new file, then open the new file to copy the sheet. I cannot tell why this only occurs when I run the EXE. I've attached the relevant VIs. I've ruled out the file type and anti-virus.
Any advice is appreciated.
Solved! Go to Solution.
08-02-2023 08:59 PM
Thank you for attaching your code. Most seasoned LabVIEW developers will have LabVIEW 2019 or 2021 installed, and relatively fewer of them have LabVIEW 2023. To all those (such as I) to open your VI, please "Save for Previous Version" and specify LabVIEW 2019 or 2021.
Bob Schor
08-03-2023 08:44 AM
Hi Bob,
Thanks for the help, I've changed them to LabVIEW 2019. I ran Copy_Sheet on its own and the same error was now produced.
08-03-2023 02:47 PM
Thanks. I think I see what you are doing, though you are getting "more in the weeds" than I typically do with Excel Workbooks (usually I try to stick to Worksheets whose structure I know, or can easily deduce, and can then use the RGT tools, including Excel Easy Table, to build my Worksheets and Workbooks.
One thing I've found that doesn't seem to be documented is what to do after you write to Excel and want to Dispose Report. The answer is "you wait" (I typically wait 200 ms). And if you want to open another Excel Report, you might want to do another Wait (I'd probably advise 500 ms). I don't think this is a LabVIEW problem, but rather Micro$oft not playing so well with other parties.
See if that helps.
Can you pinpoint where in your code things go awry?
Bob Schor
08-14-2023 10:56 AM - edited 08-14-2023 10:57 AM
Sorry for the wait, back stateside.
I think you have the solution for me. The part were the error hits in the Write Excel VI is after the Copy Sheet VI call. I placed a flat sequence to force a wait in-between the Dispose Report Ref and Copy Sheet VI calls and so far the error is gone. For whatever, reason the EXE must be running just fast enough to trigger the error by reopening the newly renamed file before the reference is closed.
With this 1 second wait, I no longer have the error. I will run more tests. Thanks so much for the suggestion Bob.
-SnakeFish