Sub xls2csv()
? ? Application.DisplayAlerts = False
? ? t = ActiveWorkbook.Name
? ? mypath = ActiveWorkbook.Path & "\"
? ? myfile = Dir(mypath & "*.xls")
? ? Do Until Len(myfile) = 0
? ? ? ? ? If myfile <> t Then
? ? ? ? ? ? ? Workbooks.Open Filename:=mypath & myfile
? ? ? ? ? ? ? ActiveWorkbook.SaveAs Filename:=mypath & Left(myfile, InStr(myfile, ".") -? ? 1) & ".csv", FileFormat:=xlCSV
? ? End If
? ? If myfile <> t Then ActiveWorkbook.Close
? ? myfile = Dir
Loop
Application.DisplayAlerts = True
End Sub