用excelmacros读写Japanse Kanjis

我目前在一家日本公司工作。 我必须将所有种类的excel文档转换为使用excelmacros的.yml文档。

这是我目前的macros,工作正常:

Function isCellEmpty(CurrentLine As Integer, CurrentCol As Integer) As String If Cells(CurrentLine, CurrentCol) = "" Then isCellEmpty = "null" Else isCellEmpty = Cells(CurrentLine, CurrentCol) End If End Function Function WhatToWrite(CurrentLine As Integer, NumberOfCols As Integer) As String Dim i As Integer WhatToWrite = " " & "Le titre je sais pas quoi" & CurrentLine - 2 & ":" & Chr(10) For i = 1 To NumberOfCols WhatToWrite = WhatToWrite & vbCrLf & " " & ActiveSheet.Cells(1, i) & ": " & isCellEmpty(CurrentLine, i) & Chr(10) Next i End Function Sub test_export_yml() Dim chemin As String Dim LastCol As Integer, LastLine As Integer, i As Integer Close 'METTRE ICI LE CHEMIN OU CREER LE FICHIER YML chemin = "C:\Users\rfayolle\Documents\Kubota traitement\Phase test\" Open chemin & "Fichier.yml" For Output As #1 'PREMIERE LIGNE DU FICHIER Print #1, "AppBundle\Entity\Test:" & Chr(10) LastLine = ActiveSheet.UsedRange.Rows.Count LastCol = ActiveSheet.UsedRange.Columns.Count ActiveSheet.AutoFilterMode = False For i = 2 To LastLine Print #1, WhatToWrite(i, LastCol) Next i Close End Sub 

以下是样本文档中的结果:

结果在yml文件

好吧,所以它的工作,很好。 问题是我在我的excel文件中有Kanjis,并且它们都是由“?” 像那样 :

与汉字错误

所以这里是我的问题: 如何在我的macros中翻译汉字?

非常感谢 !