转自:http://blog.csdn.net/jhycjhyc/article/details/3789937
Public Function leftMix(ByVal sourceString As String,ByVal mixlen As Integer) As String
'此函数用于从中英文混合字串中从左开始以半角字符的长度为单位截取若干字符,以避免该字符写入sql表中定长文本字段时可能出现的错误.'leftmix("唐纽市布通街132号广商局宿舍2幢2单元3楼1号",39)="唐纽市布通街132号广商局宿舍2幢2单元3楼1"
'一个常见的例子 .fields("地址")=leftmix((xlSheet.Cells(i,7)),50)
'须注意的是,须在模块中有此声明:Public Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As Long
Dim i As Integer
sourceString = Trim(sourceString)
For i = 1 To lstrlen(sourceString)
If lstrlen(sourceString) > mixlen Then
sourceString = Left(sourceString,Len(sourceString) - 1)
Else
Exit For
End If
Next i
leftMix = sourceString
End Function