How to save a Unicode character to a text file

后端 未结 3 749
眼角桃花
眼角桃花 2020-12-20 02:22

This is in Word for MAC VBA. I want to save the Unicode character from a text box to text file. For example this character \"⅛\".

I use this code.

D         


        
3条回答
  •  长情又很酷
    2020-12-20 02:38

    I hope this will fit VBA for Word on Mac as well, but on Windows I have the CreateTextFile method of the FileSystemObject (see MSDN doc). There I can define to create a unicode text file.

      Set fsObject = CreateObject("Scripting.FileSystemObject")
      Set xmlFile = fsObject.CreateTextFile("path/filename.txt", True, True) 'the second "true" forces a unicode file.
    
      xmlFile.write "YourUnicodeTextHere"
      xmlFile.close
    

提交回复
热议问题