Option Explicit'方法一: 使用lstrlen Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As Long'方法二: Public Function Lench(ByVal Tmpstr As String) As String Lench = LenB(StrConv(Tmpstr, vbFromUnicode)) End Function'确定 Private Sub cmdOk_Click() MsgBox lstrlen("GG您好吗?")
Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As Long'方法二:
Public Function Lench(ByVal Tmpstr As String) As String
Lench = LenB(StrConv(Tmpstr, vbFromUnicode))
End Function'确定
Private Sub cmdOk_Click()
MsgBox lstrlen("GG您好吗?")
MsgBox Lench("GG您好吗?")
End Sub