I've got this macro in MS Word 2016. It works in every word document, but I want it to work in only one word document eg 'Test.docx'. Can I add something to the code to do this?
The macro in question is this:
Sub MyMistakesFinal()
'
' MyMistakesFinal Macro
'
'
Selection.Find.ClearFormatting
With Selection.Find.Font
.Bold = True
.Underline = wdUnderlineSingle
End With
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.Previous(Unit:=wdParagraph, Count:=1).Select
End Sub
You can test whether the active document is "Test.docx". If not, exit the sub...
Sub MyMistakesFinal()
'
' MyMistakesFinal Macro
'
'
If ActiveDocument.Name <> " Test.docx" Then Exit Sub
'etc
'
'
'
End Sub
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments