View Single Post
  #26   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Fast way to truncate string

"GS" wrote:

Data type was changed from Variant in the original version to
String as last posted (shown here)...


How do I fix this? Most of the data that I'm working with are
strings.
I have tried using different combinations of CStr() or CVar(), and I
even tried changing your function declaration to the following:

Function TruncateString$(sText$ as String, sFind$, '.....)
or
Function TruncateString$(ByVal sText$ as String, sFind$, '.....)

The various errors that I'm getting a
"Invalid procedure call or argument"
"Compile error: ByRef argument type mismatch"


I have Lou Gehrig's and so I use data type symbols to save typing...

$ = As String
& = As Long
% = As Integer
# = As Double
! = As Single
@ = As Currency

...and the latest version function works with sample data typed as shown
in the Test_ sub.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion