Stripping off char from string

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to strip of the ".txt" extention from a file name.
Example:

MyPath = Dir(c:\*.txt)

' MyPath could eqaul something like DC123RE.txt

myresults = ????(MyPath)

I want MyResults to be "DC123RE" minus the .txt.
 
Mark said:
I want to strip of the ".txt" extention from a file name.
Example:

MyPath = Dir(c:\*.txt)

' MyPath could eqaul something like DC123RE.txt

myresults = ????(MyPath)

I want MyResults to be "DC123RE" minus the .txt.

MyPath = Dir(c:\*.txt)
MyPath = Left(MyPath, Len(MyPath)-4)

That's assuming that you are always looking for files with a three character
file extension.
 
Back
Top