ByRef argument type mismatch (repost)
I get a compile error, ByRef argument type mismatch,
with the following (streamlined) code. How can I fix this?
BTW, Gary, I have tried all variations of the TruncateString()
function that you posted. It still produces the same error.
Hopefully this simplified or stripped down code and help
narrow down the problem.
'--------------------------------------------------------------
Function TruncateString$(sText$, sFind$, Optional lStart& = 1)
TruncateString = Mid$(sText, lStart, InStr(sText, sFind) - lStart)
End Function
'--------------------------------------------------------------
Sub basicTest()
Dim s As String
Dim vData ' variant
s = "Hello world. Be the world. Goodnight world."
vData = Split(s, ".")
MsgBox TruncateString(vData(2), "world")
End Sub
|