LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Report Generation Toolkit Excel errors and Libraries, Classes

Hello All,

I'm using the Report Generation toolkit Excel functions to handle some data and create graphs.  I'm running into problems with the Add Worksheet.vi.  At the very start of the vi, it closes the reference to Shapes.  Occasionally, the Close Ref will throw an error.  I haven't pinned down the exact cause yet (probably an invalid reference).  The error itself wouldn't be a problem.  Under other circumstances I would choose to ignore it and continue on.  The problem is, this is stored in a Class Library controlled by NI.

 

Solutions I've tried without success:

1.) Make changes, and save the new vi with another name - can't do it because it's encapsulated and the Library is password protected.

2.) Install toolkit in something other than the default folder, so I can make changes and put it under Source Control - installer doesn't allow a new path to be entered.

3.) Change the vi where it is.  This works until I move the source to another computer or I update Labview.  At that point I lose all my changes.

 

Maybe it's just my inexperience with Classes, but I just don't see an elegant solution to this.  Ultimately I'd like to copy the library off to somewhere else and put it under Source Control so I can make changes and additions to it (NI folks - providing a password to unlock the lib would be helpful...).  Does anyone have suggestions on how I can accomplish this?

 

Thanks in Advance,

Doug

0 Kudos
Message 1 of 10
(3,303 Views)

It's really not clear what your trying to achieve but if you need a reference to shapes you can use the Excel Get ActiveX References.vi from the Excel Advanced palette. I found out that if you close these references after using them it will throw an error, so I just don't close them and it works fine.

 

Hope this help.

 

Ben64

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

Hi Ben,

Sorry about the first post.  After re-reading it, it sounds more like a frustrated rant than a request for help.

 

I've attached a simplified vi to try to illustrate the problem I'm having.  I'm running Excel 2007.  Please open the vi, then open Excel Add Worksheet.vi.  At the start of the vi, Close Ref for Excel.Shapes occasionally throws an error.  So far, I have not been able to consistently reproduce the error, so I can't really troubleshoot it.  As I recall, the error code is 1045.  The error is carried through the rest of the vi, causing invalid references to be written to Excel._Worksheet and Excel.Shapes, going out to NI_report.ctl.

 

So, here are the issues I'm running into (other than the error itself):

 

1.)Short of closing and reopening the file, there is no way to recover from the error.  After the error, there is an invalid reference in Excel._Worksheet.  There is no vi available to regenerate references in NI_report.ctl.  I could easily write a vi to start from Excel._Application and re-read them, but because NI_report.ctl is in a Class library (controlled and passworded by NI), I can't add the vi to the library.

2.) I found that I could ignore the error by wiring around it.  If I disconnect Error Out from Excel.Shapes Close Ref and wire Error In from Excel.Sheets.Count to the Error In of the Close Ref, everything works fine.  Under other circumstances, I'd save this with a new vi name (because functionality changed) and continue on.  But, because the vi is part of a Class library (controlled and passworded by NI), I can't do this.  I can save the vi with the modifications (because Excel Add Worksheet.vi is not passworded), but if I pass the source off to someone else, they will have to make the same changes on their installation of the NI Report Generation Toolkit.

 

Again, I can't reproduce the error with any regularity.  I've run the example vi I provided a few times and everything seems to work fine.  If I come up with something, I'll repost.  If you (or anyone) has an idea of what could be failing or if they've seen the problem, I'd appreciate a comment.

 

Thanks again,

Doug

0 Kudos
Message 3 of 10
(3,281 Views)

Doug, can you save it in LV2009?

 

Ben64

0 Kudos
Message 4 of 10
(3,268 Views)

Try this...

 

Doug

0 Kudos
Message 5 of 10
(3,266 Views)

I can't reproduce the error, note that I'm using Excel 2003. There may be acompatibility issue between your version of the RGT and Excel 2007 but that's up to a NI Application Engineer to answer this.

 

One wonder, do you use custom vis acting on shapes ActiveX reference somewhere else when you get this error? Are you also getting this error with the simplified version you posted?

 

Note: you should avoid modifying the Report Generation toolkit vis.

 

Ben64

0 Kudos
Message 6 of 10
(3,262 Views)

Doug:
For errors that are not persistent, I am generally pretty wary of providing short-n-sweet answers.  Unfortunately, since i have not yet been able to replicate the error, I figure something is better than nothing.

 

I dug around a little to find more information on the error number you mentioned and came across this:

 

http://digital.ni.com/public.nsf/allkb/3E4102D8B91D0F9E86256CE0006BADCB?OpenDocument 

 

I will keep trying to replicate the error, but since it does not occur with any regularity, it may be a while before I can provide you with any substantial assistance.

 

Best regards.

Matthew H.
Applications Engineer
National Instruments
0 Kudos
Message 7 of 10
(3,256 Views)

Thanks for the help guys.  If I can reproduce the failure with some regularity, I'll check back in.

 

Doug

0 Kudos
Message 8 of 10
(3,250 Views)

This is an old post, but I am having the exact same issue using LabVIEW 2016, interfacing with Excel 2016.  I can't add a worksheet at all. The error returned is 1045, and it occurs at the "Shapes" closing. Any solution?

0 Kudos
Message 9 of 10
(2,947 Views)

Hi vpicco,

 

It could be that the ActiveX is not properly registered. Follow the steps in this article to make sure its registered:

http://digital.ni.com/public.nsf/allkb/3E4102D8B91D0F9E86256CE0006BADCB?OpenDocument

 

The correct subkey for MS Excel 2016 is 1.9.

JD B.
Applications Engineer
National Instruments
0 Kudos
Message 10 of 10
(2,935 Views)