From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

why the report write opens 2 excel sheets when creating a new report

Solved!
Go to solution

whenever a generate a new report it generates 2 sheets one of a blank sheet and one a sheet from my template file. I would like to only have the report file present. But even if I had to put up with this, I can't seem to delete or save the blank window. Also this use to work with office 2013 we recently upgraded to office 2016.

 

Below is the simple code for this problem:

 


   
 
   
     
   
   
     
       
 
 
 


     
   
 
 
   
     
   
   
     
   
 


 

0 Kudos
Message 1 of 10
(2,654 Views)

Hi Blane,

 

Please attach your template Excel file.

0 Kudos
Message 2 of 10
(2,651 Views)

here is the excel template

0 Kudos
Message 3 of 10
(2,642 Views)

I'm confused, your report has 2 sheets, "Cover" and "Data".

0 Kudos
Message 4 of 10
(2,636 Views)

this a report template that we use to store results of an analysis on the testing, the cover page stores information for the testing and the data page stores the analysis of the data. The problem is that the open report function for the report generator opens 2 sheets, one blank and one with the format of the template. When I close the report it only closes the template formatted excel sheet and not the blank one. And I cannot find a method to close the blank one without using the mouse to close it.

 

 

0 Kudos
Message 5 of 10
(2,629 Views)

Microsoft made some subtle changes in Excel 2016 (from Excel 2013).  Some of these changes have not (yet) been incorporated in the RGT (Microsoft probably doesn't widely advertise the incompatibilities of its newer versions of Office routines with older ones, so it falls to its users, namely us, to find/document/fix the problems).  This might be another example of such an incompatibility.  I, myself, use Excel 2013 and have no problems opening multi-sheet Excel Files, reading different Sheets, and writing to selected Sheets.  I haven't tried this with Excel 2016, because "If It Ain't Broke, Don't Fix It".

 

Bob Schor

0 Kudos
Message 6 of 10
(2,604 Views)

First off I need to correct one thing. The code opens an empty workbook not just an empty sheet.

 

Moving back to Excel 2013 is not an option. It is corporate policy to use excel 2016.m Does anyone else know of a work around for this problem.

 

Bill Lane

0 Kudos
Message 7 of 10
(2,546 Views)

I have a library that I have used for a long time. It is all active x and it has worked from windows 95 and Office what ever it was back then through office 360. I have never really had to make any changes to it over the years. When you create a workbook it always creates two worksheets. Here is how I do what you are asking:

 

Example.png

 

 

Tim
GHSP
0 Kudos
Message 8 of 10
(2,539 Views)
Solution
Accepted by topic author blane12001

Bill,

     My apologies.  I don't have LabVIEW 2017 on my computers (it "blew them up"), so I never looked at your code.  But I have Remote Access to one with 2017 on it, and I see the Bug.  

     NI developed the Report Generation Toolkit for the purpose of (would you believe?) "Generating Reports".  That is, this is, by design, an "output-only" Toolkit.  They did provide "input" capability by (in the case of Excel) providing a Template input, which starts you off with something other than a Blank Workbook.  You then modify it, and now you are ready to Save Report.  If you look at the Help for Save Report, you'll see the second input is called "Report File Path", which you have not wired, so you saved your completed Report to the default "empty path".  You should have gotten an Error, -41003, "NI-Reports:  File open error.", pointing to the Save Report to File function (at least that's what happened when I ran it).

 

Had you reported all of this earlier, one of us (namely I, unless one of my colleagues beat me to it) would have asked "Did you wire a File Path to the Function Reporting the Error?", and your problem would have been solved when you originally posted it.  In fact, if you had done a little "digging" yourself, you could have looked up the error and deduced the problem yourself.

 

Try simply wiring the Template File Path also to the Save Report to File path input, and let us know if that Solves the Problem.  If so, please mark this post as the Solution.

 

Bob Schor

Message 9 of 10
(2,532 Views)

Bob,

 

Thanks for your help in correcting this issue. It also turns out that the office 365 excel as a standard practice opens a new workbook, even if you double clink on an excel file to open. This second workbook was also a problem. I just use a cmd line input and preformed the Taskkill function to close the second workbook.

 

Again thanks for the help

Bill Lane

0 Kudos
Message 10 of 10
(2,506 Views)