VBA - Export sheets to *.txt with date format

Post date: Sep 30, 2010 2:23:31 PM

Path = ActiveWorkbook.Path

Filename = ActiveSheet.Name

Time1 = Format(Now, "yyyymmdd_hhnnss")

ChDrive Path

fName1 = Application.GetSaveAsFilename _

(InitialFileName:=Filename & " " & Time1 & ".txt", _

fileFilter:="Text Files (*.txt), *.txt", _

Title:="Save As")

If fName1 = False Then

MsgBox "User pressed cancel, the file will be not saved!"

ActiveWorkbook.Close False

Else

Application.DisplayAlerts = False

ChDir Path

ActiveWorkbook.SaveAs Filename:=fName1, FileFormat:=xlText, AddToMRU:=False

Application.DisplayAlerts = True

a = 1

ActiveWorkbook.Close False

End If

If a = 1 Then

MsgBox "Save as " & fName1

Else

End If