取得汉语拼音的函数(适用VB,VBA,VBS)
来源:百度文库 编辑:神马文学网 时间:2024/05/16 23:53:13
Public Function HZ2PY(Tstr As String, Optional onlyFirst As Boolean)As String
On Error GoTo Err
If onlyFirst Then Tstr =Left(Tstr, 1)
Dim intTstrLong As Integer
Dim strPY AsString
Dim i As Long, p As Integer
For intTstrLong = 1 ToLen(Tstr)
i = Asc(Mid(Tstr, intTstrLong, 1))
Ifi <= Asc("啊") or i >= Asc("座") Then
strPY = strPY& Mid(Tstr, intTstrLong, 1)
Else
If i>= Asc("啊") And i < Asc("芭") Then p = 65
If i>= Asc("芭") And i < Asc("擦") Then p = 66
If i >=Asc("擦") And i < Asc("搭") Then p = 67
If i >=Asc("搭") And i < Asc("蛾") Then p = 68
If i >=Asc("蛾") And i < Asc("发") Then p = 69
If i >=Asc("发") And i < Asc("噶") Then p = 70
If i >=Asc("噶") And i < Asc("哈") Then p = 71
If i >=Asc("哈") And i < Asc("击") Then p = 72
If i >=Asc("击") And i < Asc("喀") Then p = 74
If i >=Asc("喀") And i < Asc("垃") Then p = 75
If i >=Asc("垃") And i < Asc("妈") Then p = 76
If i >=Asc("妈") And i < Asc("拿") Then p = 77
If i >=Asc("拿") And i < Asc("哦") Then p = 78
If i >=Asc("哦") And i < Asc("啪") Then p = 79
If i >=Asc("啪") And i < Asc("欺") Then p = 80
If i >=Asc("欺") And i < Asc("然") Then p = 81
If i >=Asc("然") And i < Asc("撒") Then p = 82
If i >=Asc("撒") And i < Asc("塌") Then p = 83
If i >=Asc("塌") And i < Asc("挖") Then p = 84
If i >=Asc("挖") And i < Asc("昔") Then p = 87
If i >=Asc("昔") And i < Asc("压") Then p = 88
If i >=Asc("压") And i < Asc("匝") Then p = 89
If i >=Asc("匝") And i <= Asc("座") Then p = 90
strPY = strPY& Chr(p)
End If
Next intTstrLong
HZ2PY = strPY
Exit Function
Err:
MsgBoxErr.Number & Err.Description
End Function
On Error GoTo Err
If onlyFirst Then Tstr =Left(Tstr, 1)
Dim intTstrLong As Integer
Dim strPY AsString
Dim i As Long, p As Integer
For intTstrLong = 1 ToLen(Tstr)
i = Asc(Mid(Tstr, intTstrLong, 1))
Ifi <= Asc("啊") or i >= Asc("座") Then
strPY = strPY& Mid(Tstr, intTstrLong, 1)
Else
If i>= Asc("啊") And i < Asc("芭") Then p = 65
If i>= Asc("芭") And i < Asc("擦") Then p = 66
If i >=Asc("擦") And i < Asc("搭") Then p = 67
If i >=Asc("搭") And i < Asc("蛾") Then p = 68
If i >=Asc("蛾") And i < Asc("发") Then p = 69
If i >=Asc("发") And i < Asc("噶") Then p = 70
If i >=Asc("噶") And i < Asc("哈") Then p = 71
If i >=Asc("哈") And i < Asc("击") Then p = 72
If i >=Asc("击") And i < Asc("喀") Then p = 74
If i >=Asc("喀") And i < Asc("垃") Then p = 75
If i >=Asc("垃") And i < Asc("妈") Then p = 76
If i >=Asc("妈") And i < Asc("拿") Then p = 77
If i >=Asc("拿") And i < Asc("哦") Then p = 78
If i >=Asc("哦") And i < Asc("啪") Then p = 79
If i >=Asc("啪") And i < Asc("欺") Then p = 80
If i >=Asc("欺") And i < Asc("然") Then p = 81
If i >=Asc("然") And i < Asc("撒") Then p = 82
If i >=Asc("撒") And i < Asc("塌") Then p = 83
If i >=Asc("塌") And i < Asc("挖") Then p = 84
If i >=Asc("挖") And i < Asc("昔") Then p = 87
If i >=Asc("昔") And i < Asc("压") Then p = 88
If i >=Asc("压") And i < Asc("匝") Then p = 89
If i >=Asc("匝") And i <= Asc("座") Then p = 90
strPY = strPY& Chr(p)
End If
Next intTstrLong
HZ2PY = strPY
Exit Function
Err:
MsgBoxErr.Number & Err.Description
End Function
取得汉语拼音的函数(适用VB,VBA,VBS)
取得汉语拼音的函数(适用VB,VBA,VBS)
VB函数
功能强大的SendMessage函数 vb编程
Hashtable 构造函数 ()的VB.NET例子
VB或VBA代码转HTML的加载宏
VBA内部函数
VBA内部函数-1
VBA函数参考1
提取含有文本15的数字组-vba+函数
Excel VBA高级编程:VBA日期的加减函数 - 扑奔PPT网
exe转vbs的vbs代码
VB函数大全111
VB.NET字符串函数
VB函数2
VB函数大全
转些VB函数
VB函数123
附录D VBA函数参考
VB中创建可以输出函数的DLL
VB取得系统信息代码
VB下几个非常有用的函数-VB控件-依恋网
VB.NET字符串函数1
Excel vba 里的日期加减函数是? - ExcelVBA程序开发 - Excel H...