VBA 单元格内容存为txt文本文件
作者:
JamesT | 来源:发表于
2022-05-29 16:20 被阅读0次Sub 单元格内容保存为txt文件()
myPath = ThisWorkbook.Path & "\txt\"
'*********************用ADODB.STREAM进行写入UTF-8文本******************************
For i = 2 To 50
Set OBJSTREAM = CreateObject("ADODB.Stream")
With OBJSTREAM
.Open
.Position = 0
.Charset = "UTF-8"
StrText = Cells(i, "B").Value '单元格内容
.writeText StrText '写入单元格内容
.SaveToFile myPath & Cells(i, "A").Value & ".html", 2 '存为html或者txt文件
.Close
End With
Set OBJSTREAM = Nothing
Next
End Sub
本文标题:VBA 单元格内容存为txt文本文件
本文链接:https://www.haomeiwen.com/subject/igwgprtx.html
网友评论