![Wojciech Mania](https://static.goldenline.pl/user_photo/082/user_2679890_ad11c5_basic.jpg)
Wojciech
Mania
Informatyk/wdrożenio
wiec
Temat: VBA - eksport do CSV - dodanie kodowania
Witam,Potrzebuję do poniższego kodu dodać kodowanie utf-8. Aktualnie po eksporcie brakuje mi w pliku polskich znaków :)
W sieci jest sporo przykładowych kodów ale niestety mój stopień wiedzy jest poniżej krytyki :)
Sub CopyToCSV()
Application.ScreenUpdating = False
Dim MyPath As String
Dim MyFileName As String
'The path and file names:
MyPath = "..\Desktop"
MyFileName = "export " & Format(Date, "yyyy-mm-dd")
'Makes sure the path name ends with "\":
If Not Right(MyPath, 1) = "\" Then MyPath = MyPath & "\"
'Makes sure the filename ends with ".csv"
If Not Right(MyFileName, 4) = ".csv" Then MyFileName = MyFileName & ".csv"
'Copies the sheet to a new workbook:
Sheets("export").Copy
'The new workbook becomes Activeworkbook:
With ActiveWorkbook
'Saves the new workbook to given folder / filename:
On Error Resume Next
.SaveAs Filename:= _
MyPath & MyFileName, _
FileFormat:=xlCSVMSDOS, _
Local:=True, _
CreateBackup:=False
'Closes the file
.Close False
End With
End Sub