Board logo

标题: [转贴] VBS利用ADODB.STREAM读写UTF8,还有追加写入 [打印本页]

作者: BAT221110    时间: 2022-11-14 19:11     标题: VBS利用ADODB.STREAM读写UTF8,还有追加写入

转载自:https://www.cnblogs.com/waver/articles/1283842.html
  1. FUNCTION READ4(FPATH)
  2.     DIM ADOS
  3.     SET ADOS = CREATEOBJECT("ADODB.STREAM")
  4.      
  5.     WITH ADOS
  6.         .CHARSET = "UTF-8"
  7.         .TYPE = 2
  8.         .OPEN
  9.         .LOADFROMFILE FPATH
  10.         READ4 = .READTEXT
  11.         .CLOSE
  12.     END WITH
  13.     SET ADOS = NOTHING
  14. END FUNCTION
  15. SUB WRITE1291(S1223)
  16.     DIM ADOS
  17.     SET ADOS = CREATEOBJECT("ADODB.STREAM")
  18.     WITH ADOS
  19.         .TYPE = 2
  20.         .MODE = 3
  21.         .CHARSET = "UTF-8"
  22.         .OPEN
  23.         .WRITETEXT S1223
  24.         .SAVETOFILE "EXTRACTS221114-2.CSV.TXT",2
  25.     END WITH
  26.     SET ADOS = NOTHING
  27. END SUB
  28. SUB APPEND4210321(S1419)
  29.     DIM X
  30.     X = READ4("EXTRACTS221114-2.CSV.TXT")
  31.     WRITE1291 X & VBCRLF & S1419
  32. END SUB
复制代码
追加写入似乎只能这样实现?




欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2