View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Stefano Gatto Stefano Gatto is offline
external usenet poster
 
Posts: 59
Default Filename as string

Good point!

So do this:

Function strFilenameWithoutExtension(strFilename As String) As String
Dim intPos As Integer
For intPos = Len(strFilename) To 1 Step -1
If Mid(strFilename, intPos, 1) = "." Then
strFilenameWithoutExtension = Mid(strFilename, 1, intPos - 1)
Exit For
End If
Next intPos
End Function

--
Stefano Gatto


"cush" wrote:

I don't think InStrRev was around in 97.

"Stefano Gatto" wrote:

Try InStrRev() and look for the dot, in case the suffix is more or less than
3 characters.
--
Stefano Gatto


"Dr. Stephan Kassanke" wrote:


"Mark" schrieb im Newsbeitrag
...
I am using Excel 97. Can someone please assist me with some code which
gives
me as a string the activeworkbook.name without the ".xls" at the end?

Thanks
--
Mark

Hi Mark,

try left(ActiveWorkbook.Name,len(ActiveWorkbook.Name)-4)

cheers,
Stephan