View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Paths and filenames

Hi Robert,

Am Mon, 11 May 2015 13:06:56 -0700 schrieb Robert Crandal:

"C:\tmp\files\mydata\yearly.docx"

I would need to extract the "yearly" portion. Extracting the whole
filename of "yearly.docx" would be useful too.


look for Instr and InstrRev:

mystr = "C:\tmp\files\mydata\yearly.docx"
mystr = Mid(mystr, InStrRev(mystr, "\") + 1)
mystr = Left(mystr, InStr(mystr, ".") - 1)
MsgBox mystr


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional