2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by Sawamura
1

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

Votes + Comments
Awesome!!!!
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.