borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Getting system MACID)Next Topic (How to system folder) New Topic New Poll Post Reply
AndreaVB Forum : VB General : File conversion trouble
Poster Message
Ricky
Level: Trainee

Registered: 06-07-2005
Posts: 2

icon File conversion trouble

Hi everyone, Good Day

I have 2 questions to seek for help

1) My application need to convert the .dat file to .csv file extension. I have come across a function in MSDN library that can change the file extension of a file. The syntax goes s'thing like this: public static String changeExtension( String path, String extension )

I have tried setting the string path to be C:\Documents and Settings\myfolder and the string extension to be
.csv  However I still cannot get it.

2) For the newly converted csv file,I need to insert a column in between the cells and write some text in the newly inserted column just like that of the excel application. Can this be done on VB without actually open this file using MS Excel?

I have studied some of the help files and have already add the Object Reference,MS excel 10.0 obect library in the VB project. Should I declare a variable object as excel.application, for eg: Dim filename1 as Excel.application?

PLs advice, I'm only a novice user  

09-07-2005 at 07:35 AM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: File conversion trouble

1) changing the extension will not do much. But if your task is to only change the extension the simple name function will do the job

Name "c:\test.dat" As "c:\test.csv"


2) Yes you can. Open the file using Open statement, store csv in an array. This way you can easily manupulate with rows/columns. For example, if you want to add column on 3rd position in csv file, when writting data to csv file you will put 1st two columns, then add value from this new column, then continue inserting the rest of the columns from array, and all this for every row in array.

3) Search in VBA section about hot to open excel file in VB.

____________________________
If you find the answer helpful, please mark this topic as solved.

10-07-2005 at 04:39 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB General : File conversion trouble
Previous Topic (Getting system MACID)Next Topic (How to system folder) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder