tags:

views:

34

answers:

2

Using VB6

How to convert the text file through vb6 code.

Having filename like clock.fin, time.mis, date.fin, so on...,

I want to give as clock.txt, time.txt, date.txt through code.

How to write a code?

Need VB6 Code Help.

+1  A: 

If you want to rename a file using vb6 you can do it as follows:

Set fso = CreateObject("Scripting.FileSystemObject") 
Set file = fso.GetFile("c:\oldName.txt") 
file.name = "newName.txt" 
Set file = nothing 
Set fso = nothing

Or :

 Set fso = CreateObject("Scripting.FileSystemObject") 
 fso.MoveFile "c:\oldname.txt", "c:\newname.txt" 
 Set fso = Nothing

Updated:

You can use FileSystemObject.GetExtensionName method to get the extension of a path (file) then you can replace it by "txt"

Beatles1692
+1  A: 

You can rename a file simply by:

Name "c:\xxx.fin" As "c:\xxx.txt"

There is no need to take the long way using the FSO.

Bob Riemersma