新建From1(窗体),新建Command1(按钮CommandButton),代码:
Dim strAll$, strArr$(), strPath$, strFN$
strAll = "C:\Windows\System\system.dll"
strArr = Split(strAll, "\")
strFN = strArr(UBound(strArr))
strPath = Left(strAll, Len(strAll) - Len(strFN))
Debug.Print strPath
Debug.Print strFN
运行结果:
C:\Windows\System\
system.dll