![]() |
|
#1
|
|||
|
|||
|
I need to find "Symbol" font "alpha" character and need to into "TimesNewRoman" font "alpha" character ... etc. as do the rest characters.
|
|
#2
|
|||
|
|||
|
Find the attached sample file.
|
|
#3
|
|||
|
|||
|
Is this possible or not Kindly update.
|
|
#4
|
||||
|
||||
|
Based on code from Finding and replacing symbols the following will replace the alpha and beta characters with Times New Roman font. The font size is set to 14 so you can easily see that the font has been replaced. If that works for you delete the two font size lines. You can add any other Greek characters to the array as required.
Code:
Sub Macro1()
Dim vFindText As Variant
Dim i As Integer
vFindText = Array(ChrW(-3999), ChrW(-3998))
For i = 0 To UBound(vFindText)
Call FindSymbols(FindChar:=CStr(vFindText(i)), FindFont:="Symbol")
Next i
End Sub
Sub FindSymbols(FindChar As String, FindFont As String)
Dim FoundFont As String, OriginalRange As Range, strFound As Boolean
Application.ScreenUpdating = False
Set OriginalRange = Selection.Range
strFound = False
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = FindChar
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
Do While .Execute 'Keep going until nothing found
If Dialogs(wdDialogInsertSymbol).Font = FindFont Then
strFound = True
Selection.Font.Name = "Times New Roman"
Selection.Font.Size = 14
Else
Selection.Collapse 0
End If
strFound = False
Loop
If Not strFound Then
'if nothing found, search from the beginning of the document
ActiveDocument.Range(0, 0).Select
Do While .Execute
If Dialogs(wdDialogInsertSymbol).Font = FindFont Then
Selection.Font.Name = "Times New Roman"
Selection.Font.Size = 14
strFound = True
Else
Selection.Collapse 0
End If
strFound = False
Loop
End If
End With
OriginalRange.Select
Set OriginalRange = Nothing
Application.ScreenUpdating = True
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
#5
|
|||
|
|||
|
First of all Thanks for you Reply.
Shall we highlight instead of change font size. |
|
#6
|
||||
|
||||
|
There is no need to change the size or highlight in order to change the font, however if you want highlight instead, change the two font.size lines to
Code:
Selection.Range.HighlightColorIndex = wdTurquoise
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Find What Text (^&) is not working for find Italic formatted strings
|
Mercurial | Word | 5 | 06-29-2021 05:20 PM |
| How do you use the find and replace tool to find dates and times in Excel 2013? | Jules90 | Excel | 3 | 04-14-2020 07:40 PM |
| find IP in range / find number between numbers | gn28 | Excel | 4 | 06-14-2015 03:46 PM |
Find what box in Find and replace limits the length of a search term
|
Hoxton118 | Word VBA | 7 | 06-10-2014 05:05 AM |
Bad view when using Find and Find & Replace - Word places found string on top line
|
paulkaye | Word | 4 | 12-06-2011 11:05 PM |