I am trying to remove the file extensions and any letters from file names so i can use them as dates
in one call
example: call to function
function RemoveFileName(Name as string) as string
remove here
end function
calling function
dim myDate as date
mydate = RemoveFileName("9-20-2015.rtf") or
mydate = RemoveFileName("Mo10-25-2016.rtf")
The Time sb
Dy0630.rtf would be 0630 with the Dy and .rtf removed
Rgonzo1971
then try
Function removeFilename(strDate As String) As DateSelect Case UCase(Left(strDate, 2)) Case "WK", "YR", "MO", "DY" Res = Left(Right(strDate, Len(strDate) - 2), Len(strDate) - 6) Case Else Res = Left(strDate, Len(strDate) - 4)End SelectremoveFilename = ResEnd Function
Dy0630.rtf would be 0630 with the Dy and .rtf removed