Hi again,

Does anyone know how to change file extension?
Please help me.

Thank You

Recommended Answers

All 2 Replies

Try this :

Public Function ChangeFileExt(ByVal FileName As String, ByVal Extention As String)
 Dim str() As String, NewFile As String
 If InStr(1, FileName, ".") Then
     str = Split(FileName, ".")
     NewFile = Replace(FileName, str(UBound(str)), Extention)
     Name FileName As NewFile
 Else
     Name FileName As FileName & "." & Extention
 End If
End Function

Private Sub Command1_Click()
Call ChangeFileExt("D:\test.jx", "txt")
End Sub

Or you can use another technique in this post

commented: Awesome!!!! +3

Wow..thats really awesome codes sir..
Thank you very much.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.