从Excel工作表中读取汉字

从Excel工作表中读取汉字

本文介绍了从Excel工作表中读取汉字? (始终返回"????")的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从Excel单元格读取汉字并将其写入文件?当我用

How do I read Chinese characters from Excel cells and write them to a file? When I take values by

Worksheets(ActiveCell.Worksheet.Name).Cells(3, columnNumbers(0)).value

它总是返回"?????????"

it always returns "????????"

推荐答案

Dim fileStream, FilePath As String

'Full properties file path
propFilePath = "C:\file.properties"

'Create Stream object
Set fileStream = CreateObject("ADODB.Stream")

'Specify stream type – we want To save text/string data.
fileStream.Type = 2

'Specify charset For the source text data.
fileStream.Charset = "utf-8"

'Open the stream And write binary data To the object
fileStream.Open
fileStream.writetext "write something here"

'Save binary data To disk
fileStream.SaveToFile FilePath, 2
fileStream.Close

这篇关于从Excel工作表中读取汉字? (始终返回"????")的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 21:22