patriciaxxx
Programmer
This must be simple enough but I am going round in circles getting nowhere
I want a SINGLE LINE EXPRESSION to return the file name from a string without the extension
This is my code
Function myfilename()
Dim varFileName As String
varFileName = "C:\Documents and Settings\New Folder\index.html"
varFileName = Right(varFileName, Len(varFileName) - InStrRev(varFileName, "\"))
varFileName = Left(varFileName, InStrRev(varFileName, ".") - 1)
Debug.Print varFileName
End Function
It does work and returns the file name
index
but the expression for varFileName is on 2 rows
I need varFileName = just one line here so those two expressions need to be combine into one
I want a SINGLE LINE EXPRESSION to return the file name from a string without the extension
This is my code
Function myfilename()
Dim varFileName As String
varFileName = "C:\Documents and Settings\New Folder\index.html"
varFileName = Right(varFileName, Len(varFileName) - InStrRev(varFileName, "\"))
varFileName = Left(varFileName, InStrRev(varFileName, ".") - 1)
Debug.Print varFileName
End Function
It does work and returns the file name
index
but the expression for varFileName is on 2 rows
I need varFileName = just one line here so those two expressions need to be combine into one