Untitled

 avatar
unknown
plain_text
a year ago
973 B
4
Indexable
' Replace placeholders in the letter template with dynamic data
With wordDoc.Content.Find
    .Text = "<Date>"
    .Replacement.Text = dateStr
    .Execute Replace:=wdReplaceAll
    If .Found = False Then
        MsgBox "Error: Placeholder <Date> not found.", vbExclamation
    End If
    
    .Text = "<RecipientName>"
    .Replacement.Text = recipientName
    .Execute Replace:=wdReplaceAll
    If .Found = False Then
        MsgBox "Error: Placeholder <RecipientName> not found.", vbExclamation
    End If
    
    .Text = "<Address>"
    .Replacement.Text = recipientAddress
    .Execute Replace:=wdReplaceAll
    If .Found = False Then
        MsgBox "Error: Placeholder <Address> not found.", vbExclamation
    End If
    
    .Text = "<APEAmount>"
    .Replacement.Text = apeAmount
    .Execute Replace:=wdReplaceAll
    If .Found = False Then
        MsgBox "Error: Placeholder <APEAmount> not found.", vbExclamation
    End If
End With
Editor is loading...
Leave a Comment