开发者

Extracting unicode text from Excel spreadsheet using VBA

We generate HTML from text in an Excel spreadsheet. The text contains unicode representations of international characters. When we use VBA to extract the text and output it to a file, it is written as A开发者_如何学CNSI (ASCII). Is there a way to preserve the unicode representation using VBA?

Bruce


The default file writing mechanisms in VBA are ANSI (just like VB6).

You need to use a different method. One way is to use the FileSystemObject.

   Dim fso As Object, MyFile As Object
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set MyFile = fso.CreateTextFile("c:\testfile.txt", False,True) 'Unicode=True'
   MyFile.WriteLine("This is a test.")
   MyFile.Close
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜