LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Change Sheets in Excel?

Hi,

I want to be able to change sheets in excel. I can do this by simply opening the file and changing sheets however If I were to write to the file but I require that I change the sheet then write in the specific cell.

I have attached 2 VI's.

The first starts excel rights a basic value in a specified cell and saves it with a name/location you desire. The problem is here if you try to add values to sheet2 it won't work.

The second VI is a active X for beginners vi which I got from the excel board. I used this vi to get where I am currently. This vi allows you to switch sheets and a read any value in a single cell. I hoped by using the same method I would be able to write to any cell in any sheet.
Download All
0 Kudos
Message 1 of 6
(3,413 Views)
You need to activate the sheet. After you've gotten the sheet as a variant (from the Sheets) property, use the Variant To Data function to get a worksheet object, and then call the "Select" method on it.

Also, your VI does not properly close out the references to all your objects.


Message Edited by smercurio_fc on 07-14-2008 01:36 PM
0 Kudos
Message 2 of 6
(3,404 Views)
Yes it does not XD. Thank You for the reply I will update you if I have problems.
0 Kudos
Message 3 of 6
(3,401 Views)
I misunderstood your suggestions activate? I thought you meant activesheet. How do I activate the sheet?
0 Kudos
Message 4 of 6
(3,395 Views)
By using the "Select" method, just like I said:




Message Edited by smercurio_fc on 07-14-2008 01:50 PM
0 Kudos
Message 5 of 6
(3,392 Views)
Works Thank You.
0 Kudos
Message 6 of 6
(3,386 Views)