Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Return file from a path string

One way Steph

Dim sFile
Dim ary

sFile = "C:\folder1\folder2\folder3\folder4\folder5\file.x ls"

ary = Split(sFile, "\")
MsgBox ary(UBound(ary))

or more directly, but less efficiently

Dim sFile

sFile = "C:\folder1\folder2\folder3\folder4\folder5\file.x ls"
MsgBox Split(sFile, "\")(UBound(Split(sFile, "\")))


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Steph" wrote in message
...
I have a string variable that is a path to a file:
C:\folder1\folder2\folder3\folder4\folder5\file.xl s

How can I create a new variable that is simply the file name.xls? Thanks!




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
Concatenate path and file string for external reference Michael[_4_] Excel Worksheet Functions 5 May 21st 23 11:44 AM
How to extract only file name from folder path string in Excel? JayKay Excel Worksheet Functions 1 March 20th 09 04:57 PM
Return file from a path string Tom Ogilvy Excel Programming 1 August 23rd 05 06:26 PM
Stripping Path from File String Nigel[_6_] Excel Programming 15 February 26th 04 06:35 AM
Using a variable string in a file save path Ron[_13_] Excel Programming 1 October 16th 03 08:29 PM


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