Option ExplicitPrivate Sub Command1_Click() Dim strTmp As String
strTmp = "123456789#@0000000" MsgBox Left(strTmp, InStr(strTmp, "#@") - 1) End Sub
instr判断“#@”的位置然后left取前面的字符串。
Dim Select_String as stirng '存储选取的字符串 Dim Select_Long as Long '存储选取字符串的的位置 Select_Long=instr(text1.text,"#@")-2 Select_String=left(text1.text,Select_Long)
text1.text = left(strval, instr(strval,"#@") -1)
Dim strTmp As String
strTmp = "123456789#@0000000"
MsgBox Left(strTmp, InStr(strTmp, "#@") - 1)
End Sub
Dim Select_Long as Long '存储选取字符串的的位置
Select_Long=instr(text1.text,"#@")-2
Select_String=left(text1.text,Select_Long)
text1.text = left(strval, instr(strval,"#@") -1)
Dim arr As Variant, strVal As String
strVal = "123456789#@0000000"
arr = Split(strVal, "@")
MsgBox arr(0)
End Sub