Sub ChangeFileExt($fileName As String, $newFileExt As String) As String


ChangeFileExt takes the file name specified in $fileName and changes its file extension to the new extension specified in $newFileExt.


$newFileExt specifies the new extension, including the leading dot character.


ChangeFileExt does not rename the actual file, it only returns a new file name string.


Parameters


  • $fileName ... String expression that specifies a file name.
  • $newFileExt ... String expression that specifies the new file extension, including the leading dot character.


Example:

Dim $s

$s = ChangeFileExt("e:\exp\rules.htm", ".txt")
' returns $s = "e:\exp\rules.txt"