I have a filename variable that contains : "Filename.csv"
. To extract the filename from a path I use: Filename=Dir([fStr])
where fStr
is retrieved from the file that I selected.
I only need the filename without ".csv"
. How do I remove the ".csv"
extension?
You can use the replace function:
My code runs on various systems which may not allow scripting. I rewrote this to get around this limitation.
It's best to use a function like
GetBaseName()
instead of relying on functions to replace text. Windows allows periods to appear within the base filename so something like this is legitimate:Using
Replace()
would result in:Not what you're looking for. A better approach would be: