Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-02-2019, 06:10 PM
Visor Visor is offline Block Replace Windows 10 Block Replace Office 2013
Advanced Beginner
Block Replace
 
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
 

Tags
vba find and replace



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to create a block text and when click on the title of block hide and unhide the block labasritas@free.fr Word 4 09-17-2017 01:17 PM
More than one sum in a block Verusha Singh Excel 1 11-15-2016 12:45 AM
What is this block of text? nyempire Word 5 05-26-2016 06:08 AM
VBA Word - Building Block (AutoText) - Array - Replace Text with Specific Building Blocks jc491 Word VBA 7 01-03-2016 10:34 PM
Block Replace Block a page HMS Word 2 07-12-2013 04:40 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:21 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft