Example

The following example uses the Microsoft Visual Basic Replace function to place a blue border around all paragraphs in the active document.

Sub ReplaceHTMLText()
    ActiveDocument.DocumentHTML = Replace _
        (ActiveDocument.DocumentHTML, "<p>", _
        "<p style=""border: thick dashed blue"">")
End Sub