I know there have been a lot of posts on here relating to Excel and ActiveX but I couldn't find anything that showed exactly what I am looking for.
Basically I am trying to write an array of data to an excel file but there are a number of steps that I want to go through first, I can open the reference to Excel, create a new workbook, create a new worksheet and write my data but what I can't manage to find is how to copy an existing worksheet to a new one and re-name my new worksheet. I have no concept of how ActiveX works, I have basically just copied what I have found in other posts and LabView examples so far....
What I want to do is the following:
- Open an existing workbook (template)
- Copy the first worksheet in that workbook (which will have a template layout and set calculations)
- Paste as a new worksheet with my array of data added in the correct place
- Rename the new worksheet to a name created in my program
- Repeat for a number of further worksheets with further arrays of data
- Save the workbook by a different name to preserve the template file
In my VI at the moment I have tried to use the "copy" method for the "excel._worksheet" class which does copy the correct worksheet but then puts it in a new workbook instead of adding it to the existing one and my array is added to the existing worksheet rather than the copied one. I don't seem to be able to put any input into the "before" or "after" nodes on the _worksheet invoke node, any data type that I connect to it gives me an error message and stops the program from working.
I have looked at the Excel object model map here http://msdn.microsof...y/bb332345.aspx but I have no idea what it means, is each column a subsiduary of the previous one or what? I don't get what I am looking at.
I have attached my files so far, could someone give me some pointers on this or show me where to get further information on how the whole ActiveX thing works?
Thanks
Attached File(s)
-
Write Excel simple.vi (13.71K)
Number of downloads: 55 -
Write Excel.vi (14.13K)
Number of downloads: 37 -
Template.zip (5.58K)
Number of downloads: 37
This post has been edited by postformac: 09 February 2010 - 03:02 PM

Help


Back to top
MultiQuote









