Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Filename as string


"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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Filename as string

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default Filename as string

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



  #4   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filename extract from Filepath Text String DaveyC Excel Discussion (Misc queries) 4 December 20th 07 04:04 PM
Nested String Filename Variable ed9213 Excel Worksheet Functions 9 February 12th 07 02:27 AM
Macro to open most recent file with a particular filename string kwiklearner Excel Discussion (Misc queries) 1 August 23rd 06 01:24 AM
substitute the filename in a cell reference with a string in another cell. flummi Excel Discussion (Misc queries) 11 February 22nd 06 01:14 PM
How to activate a file when the filename is represented by a string variable news.sintef.no Excel Programming 4 February 6th 04 02:17 PM


All times are GMT +1. The time now is 11:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"