Replace in text field

  • Thread starter Thread starter Les
  • Start date Start date
L

Les

On exit from a text box I need to check the text string and replace all the
spaces with an underscore. I have tried to work out the replace command but
without success.

My text box is names strMessage.

Can someone please give me the correct syntax for this

Thanks

Les
 
Sub testChanging(
MsgBox ChngSpc2Undscr("Bla, bla, bla"
End Su

Function ChngSpc2Undscr(ByVal sometext As String) As Strin
Dim pos As Lon

D
pos = InStr(pos + 1, sometext, " ", vbBinaryCompare
If pos > 0 Then Mid(sometext, pos, 1) = "_" 'replace space with underscor
Loop While pos >

ChngSpc2Undscr = sometex

End Functio
 
Back
Top