Someone posted a great little function here the other day that separated the full path of a file into several parts that looked like this:
Function BreakDown(Full As String, FName As String, PName As String, Ext As String) As Integer If Full = '' Then BreakDown = False Exit Function End If If InStr(Full, '\') Then FName = Full PName = '' Sloc% = InStr(FName, '\') Do While Sloc% <> 0 PName = PName + Left$(FName, Sloc%) FName = Mid$(FName, Sloc% + 1) Sloc% = InStr(FName, '\') Loop Else PName = '' FName = Full End If Dot% = InStr(Full, '.') If Dot% <> 0 Then Ext = Mid$(Full, Dot%) Else Ext = '' End If BreakDown = True End Function
However if the line continues past that point it counts it as part of the extension, is there anyway to make this only count to 3 characters after the last period in a string?
Mid$ syntax: Mid(string, start[, length])