Public Shared Function PinYinGet(ByVal t1 As String) As String
'将姓名转换为字母
On Error Resume Next
Dim sOne, sChar, sRet As String, i As Integer
For i = 1 To Len(t1)
sChar = Mid(t1, i, 1)
sOne = ""
If Asc(sChar) > 0 Then
If UCase(sChar) <= "Z" And UCase(sChar) >= "A" Then
sOne = UCase(sChar)
Else
sOne = "" '=sChar
End If
ElseIf Asc(sChar) >= Asc("啊") And Asc(sChar) < Asc("芭") Then
sOne = "A"
ElseIf Asc(sChar) >= Asc("芭") And Asc(sChar) < Asc("擦") Then
sOne = "B"
ElseIf Asc(sChar) >= Asc("擦") And Asc(sChar) < Asc("搭") Then
sOne = "C"
ElseIf Asc(sChar) >= Asc("搭") And Asc(sChar) < Asc("蛾") Then
sOne = "D"
ElseIf Asc(sChar) >= Asc("蛾") And Asc(sChar) < Asc("发") Then
sOne = "E"
ElseIf Asc(sChar) >= Asc("发") And Asc(sChar) < Asc("噶") Then
sOne = "F"
ElseIf Asc(sChar) >= Asc("噶") And Asc(sChar) < Asc("哈") Then
sOne = "G"
ElseIf Asc(sChar) >= Asc("哈") And Asc(sChar) < Asc("击") Then
sOne = "H"
ElseIf Asc(sChar) >= Asc("击") And Asc(sChar) < Asc("喀") Then
sOne = "J"
ElseIf Asc(sChar) >= Asc("喀") And Asc(sChar) < Asc("垃") Then
sOne = "K"
ElseIf Asc(sChar) >= Asc("垃") And Asc(sChar) < Asc("妈") Then
sOne = "L"
ElseIf Asc(sChar) >= Asc("妈") And Asc(sChar) < Asc("拿") Then
sOne = "M"
ElseIf Asc(sChar) >= Asc("拿") And Asc(sChar) < Asc("哦") Then
sOne = "N"
ElseIf Asc(sChar) >= Asc("哦") And Asc(sChar) < Asc("啪") Then
sOne = "O"
ElseIf Asc(sChar) >= Asc("啪") And Asc(sChar) < Asc("期") Then
sOne = "P"
ElseIf Asc(sChar) >= Asc("期") And Asc(sChar) < Asc("然") Then
sOne = "Q"
ElseIf Asc(sChar) >= Asc("然") And Asc(sChar) < Asc("撒") Then
sOne = "R"
ElseIf Asc(sChar) >= Asc("撒") And Asc(sChar) < Asc("塌") Then
sOne = "S"
ElseIf Asc(sChar) >= Asc("塌") And Asc(sChar) < Asc("挖") Then
sOne = "T"
ElseIf Asc(sChar) >= Asc("挖") And Asc(sChar) < Asc("昔") Then
sOne = "W"
ElseIf Asc(sChar) >= Asc("昔") And Asc(sChar) < Asc("压") Then
sOne = "X"
ElseIf Asc(sChar) >= Asc("压") And Asc(sChar) < Asc("匝") Then
sOne = "Y"
ElseIf Asc(sChar) >= Asc("匝") Then
sOne = "Z"
End If
sRet = sRet & sOne
Next i
Return sRet
End Function