LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Around Error -41112 in Report Generation Toolkit

Solved!
Go to solution

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...


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 11 of 16
(1,449 Views)

@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

0 Kudos
Message 12 of 16
(1,441 Views)

@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)


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 13 of 16
(1,436 Views)

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.

Carlton
CLA
0 Kudos
Message 14 of 16
(1,104 Views)

This vi works for my case. Thank you !

0 Kudos
Message 15 of 16
(625 Views)

@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 

TeraTech_0-1676049973944.png

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)

 

^TeraTech.

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Check out this lengthy post of mostly complaints)
0 Kudos
Message 16 of 16
(429 Views)