If dtSQL.Rows(0)("Guestname").ToString Is DBNull.Value = False Then
With oDoc.Content.Find
.Forward = True
.Format = False
.MatchCase = True
.MatchWholeWord = True
.MatchWildcards = True
.MatchSoundsLike = True
.MatchAllWordForms = False
.Font.Bold = False
oDoc.Content.Find.Execute(FindText:="TO:",
ReplaceWith:="TO: " & dtSQL.Rows(0)("Guestname").ToString, Replace:=Microsoft.Office.Interop.Word.WdReplace.wdReplaceAll)
End With
End If
With oDoc.Content.Find
.Text = "To:"
.Replacement.Text = "^& " & dtSQL.Rows(0)("Guestname").ToString
.Forward = True
.Wrap = Microsoft.Office.Interop.Word.WdFindWrap.wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute(Replace:=Microsoft.Office.Interop.Word.WdReplace.wdReplaceAll)
End With
pls try
Open in new window
Regards