View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rob Bovey Rob Bovey is offline
external usenet poster
 
Posts: 811
Default remove last part of string

"Mitch" wrote in message
...
I need to create a text string from a variable length file name by removing
the .xls from the end of the file name. It would be easy if the file
names
were a fixed length, but they are not. Is there another easy way?


Hi Mitch,

Here's one way to do it:

Dim szFilename As String
Dim szNameOnly As String
szFilename = "My File Name.xls"
szNameOnly = Left$(szFilename, Len(szFilename) - 4)

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm