PDA

View Full Version : [SOLVED:] Macrons



VB-AN-IZ
07-05-2016, 06:45 AM
How does one find macron (https://en.wikipedia.org/wiki/Macron) characters (specifically ĀāĒēĪīŌōŪū) within the VBA?

I can manually type/find these macron characters within a Word document easily enough, but ... those same key combinations are achieving something different within the VBA. I'm sure the answer's right in front of me but I must have trialed and erred just about every possibility...

All I need to know is whether to match wildcards and what to find within the quotes:



.MatchWildcards = True/False
.Execute findtext:="", ReplaceWith:="", Replace:=wdReplaceAll


Thanks for any help.

gmaxey
07-05-2016, 09:07 AM
Use the AscW character number. For example the A macro is 256:


Sub ScratchMacro1()
'A basic Word macro coded by Greg Maxey
Dim oRng As Word.Range
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = ChrW(256)
.Replacement.Text = "A"
.Execute Replace:=wdReplaceAll
End With
lbl_Exit:
Exit Sub
End Sub

Select a character and run: ?AscW(Selection.Text) in the immediate window to find the AscW number.

VB-AN-IZ
07-05-2016, 09:38 AM
Excellent. Thanks very much!