LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ActiveX, export data to Excel, error 1045 appears only when built as an application

Hi,

I received a program from a previous company that needed update, mainly to export a data array into a preexisting excel file. Since I have only the base version of the program, I had to work with ActiveX instead of report generation. I found this tutorial provided by National Instrument and followed it to the T. When used within Labview, it worked perfectly fine. However, when I built an application, an error message showed up, specifically error 1045. I had that error within Labview, when I would not connect the close reference boxes properly. However, the boxes are linked exactly like the tutorial, works within the Labview program, but gets me the 1045 error when built as an application. Anyone knows why?

 

*I just started using Labview last week, and no one else at my company could teach me, so I tend to follow tutorials mostly.

 

Tutorials used: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YITsCAO&l=en-CA, as well as the internal tutorial in Excel - Write Table

0 Kudos
Message 1 of 2
(1,180 Views)

Error 1045 means you connected a null reference to a "close reference" node.  It's something you don't technically have to do in order to make your code work one time, it's something you do so that if you run it a million times before closing your program you don't have a million copies of the reference in memory, taking up RAM that it doesn't need.

 

The error usually comes from one of 3 things:

1. You are closing the same reference twice and get the error the second time

2. You are closing a "child" of something that went null after its parent was previously closed, i.e. you didn't close your references in reverse order of getting them.

3. You are trying to close a reference that was null to begin with due to an upstream error (for instance:  If your "Range" lookup fails, the reference it produces will generate this error).

 

In the first and second cases, the error can be ignored, but it's a sign to check your code to see if you can structure it better so it doesn't happen.

 

If it's the 3rd case, then it means you have an actual issue, but instead of seeing the actual issue, you're seeing a "side effect".  If you wired it up exactly like the example does, then that means it looks like this:

 

Kyle97330_0-1615397460259.png

And if that's the case, then any errors from either of the two "Range" nodes and anything upstream of the "_Worksheet" node will be ignored because the error wires are not connected.

 

I would do three things:

1. Add the missing error wiring

2. Add something to your code that tells you which of the 4 "close reference" nodes have a problem

3. Post your actual code here so we can see it if you still have problems.

0 Kudos
Message 2 of 2
(1,139 Views)