LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error -2146827284 occurred at Exception occured in Microsoft Office Excel: Unable to set the LineStyle property of the Borders

Hi,

I've got a LabView 2015 program running in Windows 7 that:

  1. Opens a spreadsheet and loads a bunch of data (test bench master.xls).
  2. Prompts the user for some input.
  3. Runs some tests.
  4. Opens a template spreadsheet.
  5. Writes the result data into a new instance of the template.

Recently I added a feature to Step 2 to write some of the user input back into a particular column in a particular worksheet of "test bench master.xls" using the "Excel Easy Table" vi.  It does accomplish this task correctly without warning on my laptop where I have LabVIEW installed and Excel 2010.  It does the same when I build the application and run it on the customer's computer with Excel 2007, but it generates an error (named in the title of this message) an error window.  The user must press okay in the error window, and then the data writes.

 

I get the same results with the sub vi that accesses Excel separate from my program, so I've just attached the sub vi here.  I'll also include some screen captures about the two PC environments and the "test bench master.xls" spreadsheet with proprietary stuff removed.

 

The sub vi basically reads the column of data, pads the new data with blank lines if it is smaller in size then the original data, and then writes the new data back to the spreadsheet overwriting the existing data.

 

How do I make the error go away?

 

0 Kudos
Message 1 of 7
(5,168 Views)

If I understand correctly, there isn't a problem with the way your program is running. It's just throwing an unnecessary error that is annoying to click past? 

 

You can ignore this specific error in LabVIEW programmatically, which will stop that dialog from popping up. Here's a link to a document with instructions and code snippets that you can drag and drop into your code:

 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P85KSAS

 

Hope this is helpful!

Francine P.
Applications Engineering
National Instruments
Message 2 of 7
(5,044 Views)

Hi francine.p.  Thanks for the reply.  Yes, you are understanding me correctly.  I hadn't thought of ignoring the error.  I'm wondering whether we should find the source of the error?  Could it be warning me of some significant problem in my VI?

0 Kudos
Message 3 of 7
(5,022 Views)

If you're trying to find where the error occurs, you can wire separate instances of the Simple Error Handler VI throughout your code, and track execution to see where the error occurs. You can also disable parts of your code to see if this stops the error from occurring using the Diagram Disable structure.

Francine P.
Applications Engineering
National Instruments
0 Kudos
Message 4 of 7
(5,013 Views)

Hi Francine - Yes, I've done this.  It definitely occurs at when I call the NI VI "Excel Easy Table".  See attachment to first posting.  Ignoring an error that is not applicable could be a perfectly good solution, just want to make sure nothing is wrong first.  Thanks! Andy

0 Kudos
Message 5 of 7
(5,005 Views)

This seems to be a relatively frequent error when you use different versions of Excel. A possible fix I've seen is to clear the formatting before writing back the data. Translated into LabVIEW that would mean in this case using the Excel Set Cell Color and Border.vi (with a transparent background color).

Clear Formatting.png

Message 6 of 7
(4,998 Views)

Got it.  Thank you.  This looks like a decent solution.  Not super intuitive, but maybe a little better than ignoring the error, and likely better then digging into the nitty-gritty of NI/Windows interface.  It may be a while before I'm back at the customer site, but I'll be sure to mark as solution if it works.  If it doesn't, guess I'll have more questions.  Anything you suggest checking when I'm there that might help if this doesn't work?  Thanks again!

0 Kudos
Message 7 of 7
(4,988 Views)