Showing results for 
Search instead for 
Did you mean: 

Open an Excel template in LAbVIEW

All, I am once again I am working on something that I thought would be quite simple, but which is turning out to be quite frustrating.  I want to open an excel file in my front panel and then allow the operator to input values into various cells.  My first attempt was to create a table and populate it with an Excel spreadsheet.  The problem was that I did not keep basic Excel functionality such as the ability to include drop-downs or to adjust column widths or to include formulas.  I have changed tacts and have now placed an ActiveX container on the front panel and inserted an ActiveX Object (Microsoft Office Spreadsheet 11.0).  Then I added a VI to open's a modified VI from a colleague from a couple of years ago. (See below).  The problem is that I can't seem to figure out how to open a SPECIFIC Excel template in the ActiveX container, since I cannot change the property to a Write, rather than a read.  I even had our NI rep in my office today and we could not seem to figure out a straightforward way to do this...Any suggestions?
0 Kudos
Message 1 of 15
The two objects are not of the same class (regardless of the name), so you wouldn't be able to connect one to the other even if the property were writeable. As far as I know the only way to do it is to copy the data from your Excel workbook (using ActiveX) to the Office Spreadsheet control's sheet.
0 Kudos
Message 2 of 15
Thanks smercurio...I hate to ask, but can you provide some detail as to how you'd go about copying data from the existing Excel woorkbook (assuming by this, you mean my template) to the Office Spreadsheet control's sheet.  It sounds simple enough, but I'm brand new to the ActiveX functionality and I'm not having much luck searching on that topic.
0 Kudos
Message 3 of 15

I don't know if you can wait that long, but when i get back into work tomorrow morning, i'll post up a couple of VIs that you might find useful.  I've used ActiveX a fair bit with Excel - i'm not an expert, but i can usually make it work.


In fact, i've recently posted one of my Excel related libraries here.  If you have a look through the VIs, you might get some ideas.  If you need/want me to explain any of them, just ask.

Message Edited by James Mamakos on 05-15-2009 03:14 AM

Never say "Oops." Always say "Ah, interesting!"

Message 4 of 15
You can find lots of examples on using ActiveX with Excel on this forum by a simple search. You can also find others on the Excel thread.
0 Kudos
Message 5 of 15

James, that would be INCREDIBLY helpful (and kind of you).  Anything you could post or send me would be most appreciated.  Thanks so much!

0 Kudos
Message 6 of 15
If you had clicked on James' link in his message it would have taken you to his post where he posted his code, which by the way, he was actaully asking for critique. Also, if you had clicked on the link that I had provided to the Excel thread, you would have have found in the second message a starter toolkit with lots of Excel functions. Click links...
0 Kudos
Message 7 of 15

Were you able to download the library?  I put a link to it in my last post.  I've collected together the most useful VIs from that library and put them in the folder I'm attaching now.  They are all ready to be used straight-out-of-the-box, so to speak.  The other VIs in the library (obtained by following the link in my last post) are specific to my application, but you can still look through them so see what and how I've done things.


P.S.  The one entitled 'Bold Font' can actually be used to do anything to the font - just click on the property node to select another font property.

Never say "Oops." Always say "Ah, interesting!"

0 Kudos
Message 8 of 15

Guys, I really appreciate all your help and assistance. What I really want to be able to do is to open an instance of Excel right on the front panel (see attached below), as opposed to opening Excel is a separate window.  I really like the appearance and functionality that I get with an ActiveX container with a Microsoft Office Spreadsheet 11.0 inserted.   I just want to be able to open a specific file (template) within that ActiveX container. This way, the user never leaves LabVIEW.  IS there a straightforward way to accomplish this? Does this make sense? 

0 Kudos
Message 9 of 15
Oh, it was perfectly clear what you're asking. It's just that with that ActiveX control you have certain limitations. Now, there is another method which may or may not be amenable, depending on your needs: use the browser control (Controls -> .NET & ActiveX -> Web Browser). An Excel workbook can be embedded inside a browser and it will act very much like Excel. Won't see the Excel menus though.
0 Kudos
Message 10 of 15