End SubFunction funGetLeft(ByVal strValue As String, ByVal index As Integer) As String Dim str2 As String Dim abyte1() As Byte Dim abyte2() As Byte abyte1 = strValue For i = 0 To index * 2 - 1 ReDim Preserve abyte2(i) As Byte
abyte2(i) = abyte1(i) Next funGetLeft = abyte2 End Function
Private Sub Command1_Click()
Dim StrA As String
Dim IntLen As Long
Dim StrC As String
StrA = "ABCDEFGHIJKLMN"
IntLen = 5
'StrC = Left(StrA, IntLen)
StrC = funGetLeft(StrA, IntLen)
MsgBox (StrC)
End SubFunction funGetLeft(ByVal strValue As String, ByVal index As Integer) As String
Dim str2 As String
Dim abyte1() As Byte
Dim abyte2() As Byte
abyte1 = strValue
For i = 0 To index * 2 - 1
ReDim Preserve abyte2(i) As Byte
abyte2(i) = abyte1(i)
Next
funGetLeft = abyte2
End Function