Sub ExportActiveWorksheet()
Dim oldname$, oldpath$, oldformat
Application.DisplayAlerts = False 'avoid safetey alert
With ActiveWorkbook
oldname = .Name
oldpath = .Path
oldformat = .FileFormat
.ActiveSheet.SaveAs _
Filename:="c:\file.csv", FileFormat:=xlCSV
.SaveAs Filename:=oldpath + "\" + oldname, FileFormat:=oldformat
End With
Application.DisplayAlerts = True
End Sub
|