I use this code to save my list as a CSV UTF-8
file but it save it as a CSV UTF-8 BOM
file.
I need it to be without BOM. I'm not that good at coding so hope someone will help me adjust the code, so it will save my list as a CSV UTF-8
without the BOM
.
This is the code I use:
Sub SaveList_To_CSV()
Dim MyPath As String, MyFileName As String, rng As Range
Dim C As Range
MyPath = Sheets("Dashboard").Range("B11").Value 'contain the save location for new file
MyFileName = Sheets("Dashboard").Range("B14").Value 'contain the name for new file
If Not Right(MyPath, 1) = "\" Then MyPath = MyPath & "\"
If Not Right(MyFileName, 4) = ".csv" Then MyFileName = MyFileName & ".csv"
ActiveWorkbook.Sheets("List_Sheet").Copy 'name of the sheet we want to save as CSV
Set rng = ActiveWorkbook.Sheets(1).UsedRange
rng.Offset(0, 1).Clear 'keep only the first column
For Each C In Selection
If Len(C) = 0 Then C.ClearContents
Next C
ActiveWorkbook.SaveAs FileName:=MyPath & MyFileName, FileFormat:=xlCSVUTF8, CreateBackup:=False
ActiveWorkbook.Close
Workbooks.Open FileName:=MyPath & MyFileName
ActiveWorkbook.Save
ActiveWorkbook.Close
MsgBox "List Export Successful!"
End Sub