ChangeFileExt changes the extension of a file name.
Example:
When you type the new extension into Edit1, put the "." in first. An
example of this is .txt
procedure TForm1.Button5Click(Sender: TObject);
var S1 : String;
begin
if OpenDialog1.Execute then
Memo1.Lines.LoadFromFile(OpenDialog1.FileName);
S1 := ChangeFileExt(OpenDialog1.FileName, Edit1.Text);
Memo1.Lines.SaveToFile(S1);
end;