Public Shared Function GetPinYin(ByVal t1 As StringAs 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 
= ""
                
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

输入汉字取得它的拼音
posted on 2007-06-19 14:18  小黑三  阅读(686)  评论(1编辑  收藏  举报