Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Split function to get a relative path

I have a full file path and I want to extract only part of the path
using the VBA split function.

For example, in C:\windows\excel\archives\blah.xls I want to extract
"\excel\archives" only.

I have the C:\windows already in another cell. So basically I just
want to cut off this part as well as the file name to give me my
relative path. Any suggestions?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Split function to get a relative path

=SUBSTITUTE(LEFT(J1,FIND("~",SUBSTITUTE(J1,"\","~" ,LEN(J1)-LEN(SUBSTITUTE(J1
,"\",""))))-1),G1,"")

assuming path in J1, C:\Windows\ in G1, note trailing \.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Jon" wrote in message
oups.com...
I have a full file path and I want to extract only part of the path
using the VBA split function.

For example, in C:\windows\excel\archives\blah.xls I want to extract
"\excel\archives" only.

I have the C:\windows already in another cell. So basically I just
want to cut off this part as well as the file name to give me my
relative path. Any suggestions?



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
Relative Path to a Folder Heliocracy Excel Discussion (Misc queries) 3 October 3rd 07 04:28 PM
how to change absolute path to relative path hwijgerse Excel Worksheet Functions 0 November 25th 05 07:18 AM
Absolute vs Relative path K2H Excel Discussion (Misc queries) 2 July 28th 05 12:50 PM
Relative path Giovaz Excel Programming 3 July 13th 04 02:21 PM
relative path. Bob Kilmer Excel Programming 0 September 12th 03 12:25 AM


All times are GMT +1. The time now is 06:34 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"