0
0

More than 3 years have passed since last update.

VBAにおけるファイル読み込み(UTF-8)

Posted at

VBAでUTF-8のファイルを1行ずつ読み込む方法。
改行コードはCR+LF。
BOM付でも問題ないはず。

Dim buffer As String

With CreateObject("ADODB.Stream")
  .Charset = "UTF-8"
  .Open
  .LoadFromFile = "ファイルパス"

  Do Until .EOS
    '' -1:ファイル全読み込み、-2:1行ずつ読み込み
    buffer = .ReadText(-2)
  Loop

  .Close
End With
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0