Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ski Ski is offline
external usenet poster
 
Posts: 5
Default Remove File Path - just keep name

I have a file name that includes the entire file path, file name, and
extension:

C:\Documents and Settings\Desktop\Master Schedules\Overall IMS -
26May2006.mpp

I need some code to shorten that to just:

Overall IMS - 26May2006.mpp

I can't just type it in because the file is different each time, based
on user input.

Thanks in advance

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Remove File Path - just keep name

ShortFileName = Right(LongFileName,Len(LongFileName) - _
InStrSev(LongFileName, Application.PathSeparator))

HTH

Charles Chickering
Ski wrote:
I have a file name that includes the entire file path, file name, and
extension:

C:\Documents and Settings\Desktop\Master Schedules\Overall IMS -
26May2006.mpp

I need some code to shorten that to just:

Overall IMS - 26May2006.mpp

I can't just type it in because the file is different each time, based
on user input.

Thanks in advance


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Remove File Path - just keep name

InStrSev
should be
InStrRev

And this will work in xl2k and above (InStrRev was added in xl2k).

Die_Another_Day wrote:

ShortFileName = Right(LongFileName,Len(LongFileName) - _
InStrSev(LongFileName, Application.PathSeparator))

HTH

Charles Chickering
Ski wrote:
I have a file name that includes the entire file path, file name, and
extension:

C:\Documents and Settings\Desktop\Master Schedules\Overall IMS -
26May2006.mpp

I need some code to shorten that to just:

Overall IMS - 26May2006.mpp

I can't just type it in because the file is different each time, based
on user input.

Thanks in advance


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Remove File Path - just keep name

Doh! I hate typos. Oh well, I guess that's what you get when you wing
stuff instead writing it in the editor. How long has the
Application.PathSeparator been around? I just included that to make it
Mac friendly as well, is that going to be a problem in earlier
versions?

Charles
Dave Peterson wrote:
InStrSev
should be
InStrRev

And this will work in xl2k and above (InStrRev was added in xl2k).

Die_Another_Day wrote:

ShortFileName = Right(LongFileName,Len(LongFileName) - _
InStrSev(LongFileName, Application.PathSeparator))

HTH

Charles Chickering
Ski wrote:
I have a file name that includes the entire file path, file name, and
extension:

C:\Documents and Settings\Desktop\Master Schedules\Overall IMS -
26May2006.mpp

I need some code to shorten that to just:

Overall IMS - 26May2006.mpp

I can't just type it in because the file is different each time, based
on user input.

Thanks in advance


--

Dave Peterson


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Remove File Path - just keep name

I believe it was there in xl95.

(I actually used to use it until I got too lazy! And we were a WinTel only
shop.)

Die_Another_Day wrote:

Doh! I hate typos. Oh well, I guess that's what you get when you wing
stuff instead writing it in the editor. How long has the
Application.PathSeparator been around? I just included that to make it
Mac friendly as well, is that going to be a problem in earlier
versions?

Charles
Dave Peterson wrote:
InStrSev
should be
InStrRev

And this will work in xl2k and above (InStrRev was added in xl2k).

Die_Another_Day wrote:

ShortFileName = Right(LongFileName,Len(LongFileName) - _
InStrSev(LongFileName, Application.PathSeparator))

HTH

Charles Chickering
Ski wrote:
I have a file name that includes the entire file path, file name, and
extension:

C:\Documents and Settings\Desktop\Master Schedules\Overall IMS -
26May2006.mpp

I need some code to shorten that to just:

Overall IMS - 26May2006.mpp

I can't just type it in because the file is different each time, based
on user input.

Thanks in advance


--

Dave Peterson


--

Dave Peterson
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
How can I remove an invalid path for an Access file from a pivot CLASSC Charts and Charting in Excel 4 December 2nd 07 02:14 PM
How can I remove an invalid path for an Access file from a pivot CLASSC Charts and Charting in Excel 0 November 30th 07 05:31 AM
Formula too long - new file path is shorter than old file path - Excel 2003 Greg J Excel Worksheet Functions 1 November 22nd 06 05:16 PM
How to remove path from macro reference seppo Excel Discussion (Misc queries) 2 February 22nd 06 07:08 AM
Remove Hyperlink Path Message Phil Hageman[_4_] Excel Programming 0 June 6th 05 01:38 PM


All times are GMT +1. The time now is 04:22 PM.

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

About Us

"It's about Microsoft Excel"