我想从文件夹路径中提取最后一个文件夹:
path = C:\Users\z204685\tecware\RESULTS\D1369_3 (R=0) Surface Failure
我想提取新字符串中“\”之后的最后一部分:
newString = "D1369_3 (R=0) Surface Failure"
也许反转路径字符串,然后使用带有“\”的 Split 函数,然后再次反转......还有更好的想法吗?
最佳答案
这是我的尝试:
Sub test()
Dim testString As String
Dim test As Long
Dim output As String
testString = "C:\Users\z204685\tecware\RESULTS\D1369_3 (R=0) Surface Failure"
test = InStrRev(testString, "\")
output = Right(testString, Len(testString) - test)
End Sub
希望它能让你接近!
关于VBA - 从右向左分割(反向),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23545972/