Blatt als UTF-8 CSV-Datei exportieren (mit Excel-VBA)

Ich möchte eine Datei, die ich in UTF-8 CSV erstellt habe, mit VBA exportieren. Beim Durchsuchen von Message Boards habe ich den folgenden Code gefunden, der eine Datei in UTF-8 konvertiert (von diesem Thread):

Sub SaveAsUTF8() 

    Dim fsT, tFileToOpen, tFileToSave As String 

    tFileToOpen = InputBox("Enter the name and location of the file to convert" & vbCrLf & "With full path and filename ie. C:\MyFolder\ConvertMe.Txt") 
    tFileToSave = InputBox("Enter the name and location of the file to save" & vbCrLf & "With full path and filename ie. C:\MyFolder\SavedAsUTF8.Txt") 

    tFileToOpenPath = tFileToOpen 
    tFileToSavePath = tFileToSave 

Set fsT = CreateObject("ADODB.Stream"): 'Create Stream object
fsT.Type = 2: 'Specify stream type – we want To save text/string data.
fsT.Charset = "utf-8": 'Specify charset For the source text data.

fsT.Open: 'Open the stream
fsT.LoadFromFile tFileToOpenPath: 'And write the file to the object stream

fsT.SaveToFile tFileToSavePath, 2: 'Save the data to the named path

End Sub 

Dieser Code konvertiert jedoch nur eine Nicht-UTF-8-Datei in UTF-8. Wenn ich meine Datei in Nicht-UTF-8 speichern und dann in UTF-8 konvertieren würde, hätte sie bereits alle darin enthaltenen Sonderzeichen verloren, wodurch der Prozess sinnlos würde!

Ich möchte eine geöffnete Datei in UTF-8 (CSV) speichern. Gibt es eine Möglichkeit, dies mit VBA zu tun?

n.b. Ich habe diese Frage auch auf der gestellt"Ozgrid" Forum. Schließe beide Threads zusammen, wenn ich eine Lösung finde.

Antworten auf die Frage(3)

Ihre Antwort auf die Frage