![]() |
|
#1
|
|||
|
|||
|
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
I appreciate your support in advance |
| 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 a page
|
HMS | Word | 2 | 07-12-2013 04:40 PM |