Advertisement
gocha

Excel User Function - LENB (UTF-8 version)

Mar 12th, 2013
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ' Excel ユーザー定義関数 - LENB (UTF-8版)
  2. ' .NET Framework が必要
  3. Function LENBW8(str As String)
  4.     Dim UTF8 As Object
  5.     Dim byteCount As Integer
  6.  
  7.     Set UTF8 = CreateObject("System.Text.UTF8Encoding")
  8.     byteCount = UTF8.GetByteCount_2(str)
  9.     Set UTF8 = Nothing
  10.  
  11.     LENBW8 = byteCount
  12. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement