LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Switch Excel columns and rows in write to spreadsheet and more

 


@bobholmgren wrote:

I'll use this I guess: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel._application(office.11).aspx

 

http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel._application_members(v=office.11).aspx

 

etc. 

 

Fun, haha


 

That is actually the .NET interface for Excel. It's not quite the same as the ActiveX interface. When you install Excel you can select "advanced installation" and select to install the Visual Basic help. This should install the VBAXL10.CHM file on your computer. This will contain the reference information for the Excel object model.

 

 


Another issue is that I still haven't figured out how to do is get a macro set up without having to give the VI a special excel document each time with the macro already in it. I want this process to be pain free for the user

A macro needs to reside in a workbook since it is written in VBA, and that requires a VBA host, which is Excel. You can add a macro to a workbook, and there was a question on how to do this a while back. The link may even be in the Excel thread that we pointed out.

 

I would agree with Darin in principle, but I think that probably the easiest way to do this is to have a "template" Excel file that you copy and then write to the copy.

 

0 Kudos
Message 21 of 36
(1,415 Views)

This makes it look so easy... Too bad its $500

http://sine.ni.com/nips/cds/view/p/lang/en/nid/5769

0 Kudos
Message 22 of 36
(1,404 Views)

Have to weigh the cost of the product against the effort that would be involved in reproducing the work. Given what you've seen that's involved with ActiveX, the price seems pretty cheap, don't you think?

0 Kudos
Message 23 of 36
(1,397 Views)

 


@smercurio_fc wrote:

Have to weigh the cost of the product against the effort that would be involved in reproducing the work. Given what you've seen that's involved with ActiveX, the price seems pretty cheap, don't you think?


It is seeming pretty cheap. If it took me 4 days to do the same thing, it evens out to the same cost to the company. My issue though is how many copies would we need to buy of the report generation, if we'll need it on my desk computer, lab computer, and down the line maybe we switch computers and people don't realize that it needs to be installed. That's my issue with that over just using activex (as wretched as activex seems at this point)

 

0 Kudos
Message 24 of 36
(1,393 Views)

 


@bobholmgren wrote:
It is seeming pretty cheap. If it took me 4 days to do the same thing, it evens out to the same cost to the company.

Hmmm... assuming 4 days, 8 hours per day, and at a total cost of $500 that makes it about $15/hour. Wow. You're pretty cheap labor. Smiley Wink

 


That's my issue with that over just using activex (as wretched as activex seems at this point)

The toolkit actually uses ActiveX. As I noted, that's how you have to program Excel, so it has to use that**. Smiley Wink

 

** Technically, you can also use ADO, but that's a different story.

 

0 Kudos
Message 25 of 36
(1,383 Views)

 


@smercurio_fc wrote:

 


@bobholmgren wrote:
It is seeming pretty cheap. If it took me 4 days to do the same thing, it evens out to the same cost to the company.

Hmmm... assuming 4 days, 8 hours per day, and at a total cost of $500 that makes it about $15/hour. Wow. You're pretty cheap labor. Smiley Wink

 


That's my issue with that over just using activex (as wretched as activex seems at this point)

The toolkit actually uses ActiveX. As I noted, that's how you have to program Excel, so it has to use that**. Smiley Wink

 

** Technically, you can also use ADO, but that's a different story.

 


 

I overestimated the 3 day and 4 day barrier because I didn't feel like doing the math, haha.

 

yeah, I know that the report gen software uses activex, haha.

 

Still not sure how to deal with installing it on multiple computers, i guess I have to read the licensing

0 Kudos
Message 26 of 36
(1,377 Views)

It depends on which Licensing Option you choose.  If you would like additional clarification about your specific licensing options, contact your technical sales representative and he/she will be more than happy to help you further.

 

I hope this helps!

 

- Greg J

0 Kudos
Message 27 of 36
(1,372 Views)

 


@Darin.K wrote:

One thing I would try, and again I very rarely use Excel.  Read the project.xls file (or an empty xls file you create with the proper macro) as a binary file and store it in a string constant.  When it comes time to create your new Excel File, just write the string constant as a binary file in the proper location.  Now you have an Excel file with the Macro in it already, and you don't have this extra file hanging around.


 

I've been pursuing this route, and i think its the best one so far. I can create macro's for everything I want (Create new worksheet, create a graph, go to next worksheet, etc). The issue I'm running into is using labview 7.1 to write out a binary file. I extracted the binary digits from the .xls I made, so I have a string of pure 0's and 1's. When I try to write it with "Write File," it is writing it as a string. Obviously, I need to write it as a binary file. 


Suggestions?

 

Thank you

 

0 Kudos
Message 28 of 36
(1,364 Views)

So long as you don't wire the convert eol and line mode terminals the string you write will be the binary data.  You can use the string data you got from Read File directly in Write File. 

 

Test:  Create your Excel File.  Open it, Read it to a string, Close it, Open a new file, Write the String to it, Close it.  Now open the new file in Excel and it should be fine.   I have an example in LV6 if you need it, but it is pretty straightforward.

0 Kudos
Message 29 of 36
(1,360 Views)

 


@Darin.K wrote:

So long as you don't wire the convert eol and line mode terminals the string you write will be the binary data.  You can use the string data you got from Read File directly in Write File. 

 

Test:  Create your Excel File.  Open it, Read it to a string, Close it, Open a new file, Write the String to it, Close it.  Now open the new file in Excel and it should be fine.   I have an example in LV6 if you need it, but it is pretty straightforward.


 

I tried just that, and I'm outputting an empty file each time.

I've included my template file for testing purposes (though its not a final template)

 

Download All
0 Kudos
Message 30 of 36
(1,352 Views)