Hi y'all,
I'm trying to export an excel sheet as CSV comma delimited. I've put this code together but I do not get the comma delimitation. Furthermore, some figures contained in the sheet turn into dates in the CSV file. Any ideas? thanks :-)
Sub saveSheetToCSV()
Dim myCSVFileName As String
Dim tempWB As Workbook
Application.DisplayAlerts = False
On Error GoTo err
myCSVFileName = ThisWorkbook.Path & "\" & "CSV-PRAP-" & VBA.Format(VBA.Now, "dd-MMM-yyyy hh-mm") & ".csv"
ThisWorkbook.Sheets("Upload PRAP eNVenta").Activate
ActiveSheet.Copy
Set tempWB = ActiveWorkbook
With tempWB
Columns("AF").Delete
Columns("AE").Delete
Rows(1).EntireRow.Delete
.SaveAs Filename:=myCSVFileName, FileFormat:=xlCSV, CreateBackup:=False
.Close
End With
err:
Application.DisplayAlerts = True
MsgBox ("Done!")
End Sub
Bookmarks