ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Strip file extension from fiel name with multiple periods."file.9.69.txt" (https://www.excelbanter.com/excel-programming/438605-strip-file-extension-fiel-name-multiple-periods-file-9-69-txt.html)

Fan924

Strip file extension from fiel name with multiple periods."file.9.69.txt"
 
I am using this to strip the file extension off of a file name
Range("G6").Value = Left(ActiveWorkbook.Name, InStr
(ActiveWorkbook.Name, ".") - 1)

It messes up with multiple "."
How do I strip off the file extension and far right "." only?

Barb Reinhardt

Strip file extension from fiel name with multiple periods. "file.9
 
Try using INSTRREV , it gets the first "." from the end.
--
HTH,

Barb Reinhardt



"Fan924" wrote:

I am using this to strip the file extension off of a file name
Range("G6").Value = Left(ActiveWorkbook.Name, InStr
(ActiveWorkbook.Name, ".") - 1)

It messes up with multiple "."
How do I strip off the file extension and far right "." only?
.


Ron Rosenfeld

Strip file extension from fiel name with multiple periods. "file.9.69.txt"
 
On Tue, 19 Jan 2010 15:23:01 -0800 (PST), Fan924 wrote:

I am using this to strip the file extension off of a file name
Range("G6").Value = Left(ActiveWorkbook.Name, InStr
(ActiveWorkbook.Name, ".") - 1)

It messes up with multiple "."
How do I strip off the file extension and far right "." only?



Perhaps:

Left(activeworkbook.name, InStrRev(fn, ".") - 1)

--ron


All times are GMT +1. The time now is 02:49 PM.

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