Thread: [Solved] Block Replace
View Single Post
 
Old 09-02-2019, 06:10 PM
Visor Visor is offline Windows 10 Office 2013
Advanced Beginner
 
Join Date: Aug 2019
Posts: 38
Visor is on a distinguished road
Default Block Replace

Greetings friends of the forum.
I have macros to avoid copying, paste in my template.

In the attempt to prevent a student from copying and pasting information from other documents, I now need to avoid using the replace option as I have verified that it is possible to copy and replace in the template I am preparing
The replace code is this:
HTML Code:
Sub Replace()
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "s"
        .Replacement.Text = _
            "Possible paragraph with what will be replaced, assuming you will put a letter s to find and replace it"
        .Forward = True
    End With
    Selection.Find.Execute
    With Selection
        If .Find.Forward = True Then
            .Collapse Direction:=wdCollapseStart
        Else
            .Collapse Direction:=wdCollapseEnd
        End If
        .Find.Execute Replace:=wdReplaceOne
        If .Find.Forward = True Then
            .Collapse Direction:=wdCollapseEnd
        Else
            .Collapse Direction:=wdCollapseStart
        End If
        .Find.Execute
    End With
End Sub
What would be the code to block the use of the replace option?
I appreciate your support in advance
Reply With Quote