- 获取后缀名:split(fn,”.”)(ubound(split(fn,”.”)))
arr = Split(fn, “.”) ‘将fn以.分割成一个数组
u = UBound(arr) ‘得到数组的大小
Debug.Print arr(u) ‘取得数组的最后一个值
- 获取文件名(不含路径):ThisWorkbook.Name
- 获取文件名(不含后缀):Left(ThisWorkbook.Name, InStr(ThisWorkbook.Name, “.”) - 1)
- 获取文件绝对路径:ThisWorkbook.Path & “\” & thisworkbook.Name