Report.Replace

Find the specified text in the report and replace it with another text string.

Syntax Parameters Return value
Function Report.Replace( _
    What As String, _
    ReplaceWith As String, _
    Optional MatchWholeWord As Boolean, _
    Optional MatchCase As Boolean) As Boolean
  • What [in]

    The expression to replace in the report.

    Type: String

  • ReplaceWith [in]

    String value specifying what to replace the expression with.

    Type: String

  • MatchWholeWord [in, optional]

    Whether to search for the expression as a single expression or as part of larger words. This parameter defaults to False.

    Type: Boolean

  • MatchCase [in, optional]

    Whether or not to search for the expression case sensitively. This parameter defaults to False.

    Type: Boolean

Boolean

SVB Example

Replacing text in a report:

Option Base 1
Option Explicit
Sub Main
    Dim rpt As Report
    Set rpt = ActiveReport
    'search for the word "Median" in the active report
    Dim FoundWord As Boolean
    'search for "Median" where it is a single word
    '(i.e., not part of a larger word), don't make
    'it case sensitive, and replace it with "Mean"
    FoundWord = rpt.Replace("Median","Mean",True,False)
    'if "Median" was replaced, then the variable FoundWord
    'will be true
    If (FoundWord) Then
        MsgBox "Replaced Median with Mean"
    End If
End Sub