Showing results for 
Search instead for 
Did you mean: 

Excel worksheet and add multiple new worksheets

I have a piece of equipment that generates space delimited event logs, I can view them fine with Excel. But each log is a separate file, and I wish to get them all onto one .xls as separate sheets. Using Active X I can add one sheet with Add Before or Add After, but when I try to get a second sheet added, I lose the sheet name and add a blank "Sheet x". I've really messed around alot with the indexing and got mixed but similar results as far as placing new blank sheets around the one I moved correctly, but never got the next sheet inserted. Anyone have similar problems, maybe figure it out?
0 Kudos
Message 1 of 6
Sounds like you are trying to add several sheets using the same reference. Once you add a sheet using Before or After, you cannot trust the reference to properly point to the same sheet. You will need to close that reference and create a new one to correctly point to the new layout.

Here is a VI that I wrote for this purpose. I use it to setup a workbook with a specific number of sheets, each with a specific name. Just put it in a for loop with an array of the desired sheet names. You can also place it in your current loop, to select the next sheet before writing.

Michael Munroe
Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.0, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
Message 2 of 6

I have a bunlde of data need to be save in the excel file . In one sheet the number of data can be keep is only 65536. Any ideas to write those data in sheet 1 (data 1 - 65536),

Sheet 2 (data 65537 - data 131073) and so on? Which the progarm might need to add on the 4th or more sheet if the number of data is large.

0 Kudos
Message 3 of 6

Hi leo77,

where do you habe problems? What have you done so far? You also need to use ActiveX to write your data.



0 Kudos
Message 4 of 6
I only able to save the data into the 1st sheet. I attahed a simulation vi for your review. Active _X , can you give more details suggestion or example?
0 Kudos
Message 5 of 6

Hi leo77,

the result of you program isn't a real Excel file. The "write to spreadsheet file" function create a txt file which can be opend by excel, but that's all.

See this thread for more information about ActiveX and Excel.



0 Kudos
Message 6 of 6