Attribute VB_Name = "_cast_char2Unicode" '------------------------------------------------------------------------------- 'File : _cast_char2Unicode.bas ' Copyright mpl by ERB software ' http://wiki.yaslaw.info/dokuwiki/doku.php/vba/cast/char2Unicode 'Environment : VBA 2007 + 'Version : 1.0 'Author : Stefan Erb (ERS) 'History : 29.04.2014 - ERS - Creation '------------------------------------------------------------------------------- Option Explicit '/** ' * Copyright mpl by ERB software | http://wiki.yaslaw.info ' * ' * Wandelt ein Charakter in ein Unicode ' * @example: char2unicode("€") -> '\u20AC' ' * @param String(1) Charakter, der gewandelt werden soll ' * @return String Unicode ' */ Public Function char2unicode(ByVal iChar As String) As String char2unicode = Hex(AscW(iChar)) 'Hex-Wert ermitteln char2unicode = "\u" & String(4 - Len(char2unicode), "0") & char2unicode End Function