View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Remove DateTimestamp from String

Assuming that the structure of the date portion of the filename is this
*fixed* pattern..

yyyy-mm-dd hh.mm.ss.sss

then, assuming we are talking about .xls files, this should work...

If FileName Like "*####-##-## ##.##.##.###.xls" Then
FileName = Left(FileName, Len(FileName) - 27) & ".xls"
End If

--
Rick (MVP - Excel)


"Steve" wrote in message
...
All,
I'm working on a macro that works with the name of files in a certain
directory.

My problem is that some of the files may have a datetimestamp within
the filename.

example: "Change 69231 Ticket2008-10-01 14.48.18.953.xls"

Would like to change to "Change 69231 Ticket.xls"


How can I find and delete the timestamp within a string like the
above.

Steve