VBA - 从右向左分割(反向)

标签 vba split

我想从文件夹路径中提取最后一个文件夹:

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/

相关文章:

vba - 如何使用 pastepecial 将图表作为位图粘贴到 vba 中的另一张纸上

vba - 从 VBA 中的命名范围获取值

python - 如何使用 Python 拆分和忽略文件路径字符串中的分隔符

python - Pandas 如何通过正则表达式从列提取到多行?

java - java中分割字符串

vba - VBE 中的 CommandBarEvents.Click 和 CommandBarButton.Click 有什么区别?

vba - Application.worksheetFunction.match 无法正常工作 VBA Excel

c# - 使用定界符拆分字符串,但在 C# 中保留结果中的定界符

java - 子列表上的分区列表,其中邻居子列表的第一个和最后一个元素相同

excel - 如何在 Visual Basic For Applications 中使用 "Class Module"或 "Module"?