📅  最后修改于: 2023-12-03 15:14:55.197000             🧑  作者: Mango
在Excel VBA编程中,我们有时需要从Long Integer类型的变量中获取单词。本文将向您展示如何使用VBA代码从Long Integer类型的变量中左侧获取单词。
Dim longInteger As Long
longInteger = CLng("12345word789")
Dim start_position As Integer
Dim end_position As Integer
start_position = InStr(1, CStr(longInteger), "word")
end_position = start_position + Len("word") - 1
Dim word As String
word = Left(CStr(longInteger), end_position)
Sub get_word_from_Long_Integer()
Dim longInteger As Long
Dim start_position As Integer
Dim end_position As Integer
Dim word As String
longInteger = CLng("12345word789")
start_position = InStr(1, CStr(longInteger), "word")
end_position = start_position + Len("word") - 1
word = Left(CStr(longInteger), end_position)
MsgBox word
End Sub
以上是从Long Integer类型的变量的左侧检索单词的简单介绍,希望对您有所帮助。