View Single Post
  #22   Report Post  
Posted to microsoft.public.excel.programming
Robert Crandal[_3_] Robert Crandal[_3_] is offline
external usenet poster
 
Posts: 161
Default Fast way to truncate string

"GS" wrote:
Try using this optimized version I posted earlier...

Function TruncateString$(sText$, sFind$, Optional lStart& = 1)
TruncateString = Mid$(sText, lStart, InStr(sText, sFind) - lStart)
End Function


This function causes the following error:

Compile error:
ByRef argument type mismatch

Seems like the problem is related to the data being passed
into the "sText$" parameter, but I'm not sure.