csv to Excel using vb in Wincc flexible 2008 query

Smita

Member
Join Date
Jan 2012
Location
Goa
Posts
6
Hi All,

I have to convert my csv file to an excel sheet in Wincc Flexible 2008 for which I have written the following code snippet:
'Alarm_Log.csv' is the file I have to read and 'writing_test.xls' is the excel file that i create and then write to.

My problem is that I need to know how to add a work sheet or create a new excel sheet when the present excel sheet is full.
Could somebody kindly suggest?

Thanks!
--------------------------------------------------------------
Dim tagFilename
Dim strFilename, strLine
Dim fso, objFile, objFile_1


strFilename="C:\log\writing_test.xls"
Set fso = CreateObject("Scripting.FileSystemObject")
'filepointer to write file
Set objFile_1 = fso.CreateTextFile(strFilename,True)
tagFilename="C:\log\Alarm_log.csv"



'filepointer to read file
Set objFile = fso_OpenTextFile(tagFilename,1)

strLine =objFile.ReadAll
objFile_1.Write strLine


objFile_1.Close
objFile.Close
-----------------------------------------------------
 
Smita,

The common way is to add the date and time into your Excel File Name. Then each time you write a file, a new one is created with a new file name ("Writing_test mm-dd-yyyy hr-min-secs.xls").
 

Similar Topics

I am trying to create a recipe selector. I may be asking a lot, but hopefully, you folks can guide me. I have an excel file with 800 different...
Replies
0
Views
1,019
Software Tool box has released a great new product for users of Intouch history log files (*.lgh). Finally the abillity to export directly from...
Replies
3
Views
11,512
is it possible to convert a csv that is saved in excel to possibly a .xls or.txt file so I can read the values and insert it to a datagrid in a...
Replies
17
Views
5,915
Hi guys, I'm currently busy with a Wincc project which requires me to dump field data and physical inputs entered by an operator on a Wincc scada...
Replies
5
Views
2,026
Hi All I have a generic I/O file (excel file). I fill in that file with all the I/O point and then i create tags using this information...
Replies
4
Views
7,674
Back
Top Bottom