VBA to create a file with utf-8 format

You can create any text or html file or any other file with utf-8 encryption.


  1. Dim TempFile As String
  2.   TempFile = "TempFileName.html"
  3.     Dim fsTrm As Object
  4.     Set fsTrm = CreateObject("ADODB.Stream")
  5. With fsTrm
  6.   .Type = 2             'Stream Type - we want Text Data.
  7.   .Charset = "utf-8"    'Specify Character Set.
  8.   .Open                 'Open the Stream And write Binary data to the Object
  9.   .WriteText "String"
  10.   .SaveToFile TempFile, 2      'Save Binary Data to Disk (Overwrite)
  11. End With

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation