Try this -
Option Explicit
Sub SaveAsText6()
Dim sPath As String, sFilename As String, sOutputName As String, sInputName As String
Dim i As Long
'get text file name from user, exit if canceled
sInputName = Application.GetOpenFilename("Text (Tab Delimited) (*.txt), *.txt", , "Kutools for Excel")
If sInputName = "False" Then Exit Sub
MsgBox sInputName ' testing
'open text file
Workbooks.Open Filename:=sInputName
'do some processing
ActiveSheet.Name = "Output"
ActiveSheet.Cells(1, 1).CurrentRegion.Value = 3456
'get path
i = InStrRev(sInputName, "\")
sPath = Left(sInputName, i)
sFilename = ActiveSheet.Name
sOutputName = sPath & sFilename & ".txt"
MsgBox sOutputName ' testing
If Dir(sOutputName) <> "" Then
If MsgBox("File '" & sOutputName & "' exists. Overwrite?", vbYesNo + vbExclamation, "Kutools for Excel") <> vbYes Then Exit Sub
Application.DisplayAlerts = False
Kill sOutputName
Application.DisplayAlerts = True
End If
ActiveWorkbook.SaveAs sOutputName, xlUnicodeText
ActiveWorkbook.Close False
End Sub