Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jon,
I suggest you try this and forget using the Split function. You should stop putting periods in your file name. This function will return the file name only when the entire path and name is passed to it. If there is no extension then it won't error. I am assuming that there are no instances where you have no extension but still have periods in the file name. See the "TestFileNameOnly" routine in my first post for how to use the function. Function FileNameOnly(FileName As String) As String Dim x As Integer, y As Integer x = InStrRev(FileName, "\") y = InStrRev(FileName, ".") y = IIf(y = 0, Len(FileName) + 1, y) FileNameOnly = Mid(FileName, x + 1, y - x - 1) End Function Regards, Greg "Jon" wrote: Help! This method fails if the file does not contain an extension. I need to put it in an if statement and test if the file has a "." in it. How can I do this? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can you open files with extension xlsx? | Excel Discussion (Misc queries) | |||
How do I convert Quattro Pro files with .wb3 extension to Excel? | Excel Discussion (Misc queries) | |||
files with no extension | Excel Discussion (Misc queries) | |||
Using .FoundFiles to list files by path and file name | Excel Programming | |||
How to covert old Lotus 123 files with .123 extension to Excel? | Excel Discussion (Misc queries) |