Try something like this:
With ActiveDocument.Content.Find
.ClearFormatting
.Text = "a"
With .Replacement
.ClearFormatting
.Font.StylisticSet = wdStylisticSet01
End With
.Execute Replace:=wdReplaceAll
End With
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
(I was recommended to ask my question here, so here it goes again)
https://answers.microsoft.com/en-us/msoffice/forum/msoffice_word-msoffice_custom-mso_365hp/findreplace-opentype-alternative-characters-with-a/de0d4100-1e31-4883-9896-9860de6c2abf
As the title says, is it possible to record a macro in MS Word that replaces the font's standard lowercase "a" to its alternative "a"?
I have no problems using the Find & Replace function, but recording it with the macro doesn't yield the desired result. And setting the alternative character as standard doesn't help either since it changes all other characters as well. I'm only interested in changing the lowercase "a" alone.
Thanks in advance for the help!
(Sorry if the tags are misleading, but I couldn't create new ones)
Try something like this:
With ActiveDocument.Content.Find
.ClearFormatting
.Text = "a"
With .Replacement
.ClearFormatting
.Font.StylisticSet = wdStylisticSet01
End With
.Execute Replace:=wdReplaceAll
End With
This is the code I get when I record a macro. When I run said macro on a new text/document, it doesn't do anything.
Just manually using the "Find & Replace"-function works without issues.
Sub a()
'
' a Makro
' alternativt a
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "a"
.Replacement.Text = "a"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub