01-25-2016 09:32 AM - edited 01-25-2016 09:33 AM
I know this isn't that helpful...but this problem actually prompted us to completely rewrite the reporting/logging function of some software to write to CSV files rather than using the RGT. We tried all sorts of workarounds such as locking the file, opening Excel as hidden etc. but nothing could prevent it from locking up when the user had opened the report/log file.
A lot more work, but technically possible, would be to use something like .NET to write directly to an Open Document file, rather than hooking into Excel to do the writing.
The only thing we didn't try, but I have used before with Visio - Excel always opens documents in the same application instance, but there might be a registry/option that allows you to open workbooks in a different instance - http://answers.microsoft.com/en-us/office/forum/office_2010-excel/open-each-spreadsheet-in-a-new-ins...
01-25-2016 09:49 AM
@Sam_Sharp wrote:
I know this isn't that helpful...but this problem actually prompted us to completely rewrite the reporting/logging function of some software to write to CSV files rather than using the RGT. We tried all sorts of workarounds such as locking the file, opening Excel as hidden etc. but nothing could prevent it from locking up when the user had opened the report/log file.
I agree with you Sam, I too use csv files as much as possible and sometimes xml and database. Althought opening a new application instance will work if someone is editing another instance of Excel if somebody decide to open and edit the file currently use for reporting it will generated an error.
Ben64
01-25-2016 10:09 AM
@ben64 wrote:
I agree with you Sam, I too use csv files as much as possible and sometimes xml and database. Althought opening a new application instance will work if someone is editing another instance of Excel if somebody decide to open and edit the file currently use for reporting it will generated an error.
Ben64
Yes - and the workaround we used for that was to change the permissions on the file to make it read-only while not writing to the file from the RGT (i.e. after finishing RGT write, close file and make read only)
03-21-2017 10:18 AM
I agree with the use of CSV files. Unfortunately for this project the client has an Excel template that all of the data has to be written to. What I ended up doing was just attempting to write the data to Excel and if there is an error it will just dump the data to a CSV file which can later be imported into the master Excel file.
03-05-2021 10:13 AM
This vi works for my case. Thank you !
02-10-2023 10:56 AM - edited 02-10-2023 11:45 AM
@ben64 wrote:
I have a similar issue on a test setup and the operators knows that they can't use Excel when a test is running. I tried a few things this weekend and realize that the vi I posted earlyer will not work if someone is actively typing (it works only if a cell is activated for editing but there is no actual typing performed). I then modified a vi to create a workbook and fill some cells in a new application windows. I ran it while editing manually another workbook and since the workbook was created in another application window I didn't get any error and the new workbook was created as expected.
I wrote a post in the LabVIEW Idea Exchange asking to add an optional "open in new instance" boolean input to the New Report.vi. You can kudo this idea in the LabVIEW Idea Exchange forum.
Ben64
7 years later... Too bad the idea exchange submission was declined. I have the same issue.... well, I had.
I downloaded your "Save Active Workbook.vi" ran my own tests. The VI does appear to work in both the circumstances mentioned. I opened a new workbook, typed some text in a cell, and without hitting enter (the cell is actively being edited) I switched to LabVIEW and ran the Save Active Workbook vi. You can see in the Excel title bar "Book1.xlsx . Saved" The only caveat, this message will sometimes pop up
I can't nail down the exact situation. It will sometimes save and overwrite without the prompt. 🤔
Perhaps it was "fixed" in Office or perhaps in LV RGT 2017. IDK, but your VI seems to be working for me.
I am using
LabVIEW 2017
Microsoft® Excel® for Microsoft 365 MSO (Version 2211 Build 16.0.15831.20220) 64-bit
Excel version 2211 (Build 15831.20252)