ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Return file from a path string (https://www.excelbanter.com/excel-programming/338071-re-return-file-path-string.html)

Tom Ogilvy

Return file from a path string
 
If you have xl2000 or later:

sStr = "C:\folder1\folder2\folder3\folder4\folder5\file.x ls"
? Right(sStr,len(sStr)-instrrev(sStr,"\"))
file.xls

demo's from the immediate window.

--
Regards,
Tom Ogilvy

"Steph" wrote in message
...
I have a string variable that is a path to a file:
C:\folder1\folder2\folder3\folder4\folder5\file.xl s

How can I create a new variable that is simply the file name.xls? Thanks!





Steph[_6_]

Return file from a path string
 
Thank you so much

"Tom Ogilvy" wrote in message
...
If you have xl2000 or later:

sStr = "C:\folder1\folder2\folder3\folder4\folder5\file.x ls"
? Right(sStr,len(sStr)-instrrev(sStr,"\"))
file.xls

demo's from the immediate window.

--
Regards,
Tom Ogilvy

"Steph" wrote in message
...
I have a string variable that is a path to a file:
C:\folder1\folder2\folder3\folder4\folder5\file.xl s

How can I create a new variable that is simply the file name.xls?

Thanks!








All times are GMT +1. The time now is 05:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com