Excel VBA: Regular Expression - get file name

后端 未结 5 1692
轮回少年
轮回少年 2021-01-25 07:30

How do I get just filename (without path and extension)
like \"MyFileName\"
from the following full path?
C:\\A_B\\C.D\\E_\\F0123456789\\G\\MyFileName.txt

5条回答
  •  星月不相逢
    2021-01-25 07:51

    Set regEx = New RegExp
    regEx.Pattern = ".*\\"
    regEx.IgnoreCase = True
    filename = regEx.Replace(fullpath, "")
    

提交回复
热议问题