Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
VBAマクロ向け関数。指定したパスに、変数の内容を、UTF-8のテキストファイルで書き出す関数。Microsoft JET 2.8以上必須です。
'******************************************************************
'■WriteUnicodePlainText関数
'UTF-8テキスト書き出し
' 引数1:書き出し先のフルパス
' 引数2:流し込みたい文字列が入った文字列変数
'Option Explicit必須、Microsoft JET2.8以上必須
'******************************************************************
Private Sub WriteUnicodePlainText(ByVal strFN As String, ByVal strTEXT As String)
Dim adodbStream As ADODB.Stream
Set adodbStream = New ADODB.Stream
adodbStream.Type = adTypeText
adodbStream.Charset = "UTF-8"
adodbStream.Open
adodbStream.WriteText strTEXT
adodbStream.SaveToFile (strFN), adSaveCreateOverWrite
adodbStream.Close
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.