UTF-8ファイル出力したい

Dim fp As New ADODB.Stream
'Dim fp As ADODB.Stream
'Set fp = New ADODB.Stream
With fp
 .Type = adTypeText
 .Charset = "UTF-8"
 .LineSeparator = adLF 'LFのみ
 .Open
End With

fp.WriteText "出力したい文字列", adWriteLine
fp.SaveToFile ActiveWorkbook.Path & "\temp.txt", adSaveCreateOverWrite
fp.Close
標準状態ではUTF-8出力はできない。
ただライブラリは用意されているので以下の設定をして使えるようにする。
「ツール」->「参照設定」を選択し、参照設定ダイアログを開く。
その中の「Microsoft ActiveX Data Objects 2.8 Library」にチェックを入れて「OK」をクリックする。
comments (3)

コメント

chat webcam | 2017/09/06 05:41 AM
Just desire to say your article is as amazing. The clarity on your put up is just cool and i could think you are knowledgeable in this subject. Fine with your permission allow me to take hold of your RSS feed to stay up to date with forthcoming post. Thank you one million and please carry on the gratifying work.
sharenmcandrews.hatenablog.com | 2017/07/31 04:13 PM
Appreciating the commitment you put into your blog and detailed information you offer.

It's awesome to come across a blog every
once in a while that isn't the same old rehashed
information. Great read! I've bookmarked your site and
I'm adding your RSS feeds to my Google account.
Can you have an operation to make you taller? | 2017/07/29 05:52 AM
Greetings! I've been following your weblog for a while now and finally
got the bravery to go ahead and give you a shout out from Dallas Texas!
Just wanted to mention keep up the great work!

Comment Form