取得汉语拼音的函数
本来不打算发上来的,可是那天看到黄海的那个例子,居然我们是都是在6号用的,所以也发来让大家看看。这个代码是基于罗斯文数据库的代码的基础上改进的。
Public Function PY(Tstr As String) As String
Dim A, N, I As Long
Dim B, D, PinYin As String
A = Len(Tstr)
For N = 1 To A
B = Mid(Tstr, N, 1)
' Debug.Print B
I = Asc(B)
'I = Asc(Tstr)
If I >= Asc("啊") And I < Asc("芭") Then PinYin = "A"
If I >= Asc("芭") And I < Asc("擦") Then PinYin = "B"
If I >= Asc("擦") And I < Asc("搭") Then PinYin = "C"
If I >= Asc("搭") And I < Asc("蛾") Then PinYin = "D"
If I >= Asc("蛾") And I < Asc("发") Then PinYin = "E"
If I >= Asc("发") And I < Asc("噶") Then PinYin = "F"
If I >= Asc("噶") And I < Asc("哈") Then PinYin = "G"
If I >= Asc("哈") And I < Asc("击") Then PinYin = "H"
If I >= Asc("击") And I < Asc("喀") Then PinYin = "J"
If I >= Asc("喀") And I < Asc("垃") Then PinYin = "K"
If I >= Asc("垃") And I < Asc("妈") Then PinYin = "L"
If I >= Asc("妈") And I < Asc("拿") Then PinYin = "M"
If I >= Asc("拿") And I < Asc("哦") Then PinYin = "N"
If I >= Asc("哦") And I < Asc("啪") Then PinYin = "O"
If I >= Asc("啪") And I < Asc("欺") Then PinYin = "P"
If I >= Asc("欺") And I < Asc("然") Then PinYin = "Q"
If I >= Asc("然") And I < Asc("撒") Then PinYin = "R"
If I >= Asc("撒") And I < Asc("塌") Then PinYin = "S"
If I >= Asc("塌") And I < Asc("挖") Then PinYin = "T"
If I >= Asc("挖") And I < Asc("昔") Then PinYin = "W"
If I >= Asc("昔") And I < Asc("压") Then PinYin = "X"
If I >= Asc("压") And I < Asc("匝") Then PinYin = "Y"
If I >= Asc("匝") And I <= Asc("座") Then PinYin = "Z"
D = D & PinYin
Next N
'Debug.Print D
PY = D
End Function
(责任编辑:admin)
- ·关于 Partition 函数在分组查询中的应
- ·Access算术运算符的含义和说明表
- ·mid函数的另类用法
- ·access制作程序运行进度框
- ·Function与Sub的异同(函数调用)
- ·Access判断某个数值是否为某个数据类型
- ·select case后面语句块的值的四种格式
- ·vba条件语句的两种表示方法
- ·Access几种数据类型初始化的值
- ·Access vba null与""空字符串的区别
- ·access vba 数据类型表
- ·Access变量的命名规则
- ·Access中EXIT Sub与End Sub的区别
- ·Access vba中参数前关键字ByRef和ByVal
- ·Access列表框快速全选的技巧【最快】
- ·vba函数的数据类型强制转换