Replace a sequence of characters in a string.

      Replace(string, findStr, ReplaceStr, [start, [count, [compare]]])

   string     The initial text string.

   findStr    The text string to search for in string.

   ReplaceStr The new string that will replace findStr in string.

   start      The position in string to begin the search.
              default=start (character 1)

   count      The number of occurrences to replace.
              default=replace all occurrences.

   compare    The comparison mode (Binary/Text)

The Replace() function can be used in VBA or in an SQL query.


Dim strDemo as String
strDemo = Replace("Don Quijote", "Quij", "Quix")
MsgBox StrDemo
Returns: Don Quixote

“The shooting of the movie is the truth part and the editing of the movie is the lying part, the deceit part” ~ Paul Hirsch


InStr - Return the position of one string within another.

Copyright © 1999-2024
Some rights reserved