Ok here is what you do.
1.To create an excel refnum: on the controls pallette find refnums. Place an automation open refnum on the front panel.
2. Right click on the automation refnum, then select Active X class then select browse.
3. Find microsoft excel object library. this will give you all the objects for excel. use these refnums with the excel spreadsheet you want to write. Not the file refnums you are writing to.
when you are able to do this please post back with the vi you created. Do this with a new vi so we can complete each step together.
I'm still working on the code you suggested. But in the meantime, a question.
If you look at my code sample "Secret origins...", you see where I create the file. Originally, it was a text file (the extension going into the concatenate tool was originally a ".txt", not the ".xls" that's in it now) that was created. In that block of code, I created the file, wrote the initial line of data into the file, and then passed the refnum of that file on to a shift register. That shift register was passed on to other cases in my stacked sequence in order to write more data to that same file in other cases. Wiring that refnum right into the Write File tools that were elsewhere in my code worked perfectly fine for me when the file was a text file.
So I already have several instances throughout my code of wiring that refnum into a Write File tool. Can you give me a brief explanation of why it works fine for a text file, but not for an Excel file?
OK now I see your confusion.
It does not matter what type of extension you put on a file it is still a file and the refnum that it creates is still a file refnum so even if you put a .xls on the file extension does not mean that it is an excel file it just means that you will be able to trick excel into opening this without windows giving you a prompt. ie open with. when you go to open your file outside of labview. You have to , must use an active x automation refnum to use the properties and functions of excel itself.
What is your main reason for wanting to use excel functions inside labview. you can write things to a tab delimited text file that excel or any word processing program can open and if you give it a .xls extension it will be opened by excel without a prompt.
Still working on this code. Curious about any more suggestions.
I am facing a problem of writing a data in a excel sheet generated by LabVIEW. If i create a excel file manually it works very fine. But if the file is created by Open\Create function. I am not able to save the data in the file.
Thanks in advance
Could you post a simple version of your code so that i can see what you are doing because if you are trying to use the open/create to get a reference to the file to inorder to use the active X functions for excel then I do not believe that this will work.
For more information and some sample VI's and tool kits, you can go to the excel board
Thanks for the reply.
Yes i am giving the path of the new file to be created to the Create/Open New File function. See the picture attached. It works fine before where i am closing the workbook. I used your excel tool kit before. From that also i was not able to create a excel file and save repeatedly. It was telling error like "Read Only file". Though i gave correct values and also checked the file attributes. And another message was there it will write like "Tab limited Text" so I want to continue or not.