PDA

View Full Version : [SOLVED:] convert symbol to continuous numbers



Ethen5155
10-14-2017, 08:54 AM
Hi all,

i'm looking for a sample way in VBA to look for a symbol through all word files and replace it to continuous numbers

for ex:

look for all (↑) symbol at the end of following paragraphs and replace it with number (1,2,3....etc)

Find:
also of Virginia. We were extremely lucky ↑


was sure they wanted to capture Powell. ↑


It was a pleasant feeling. My body became extremely heavy ↑

Replace:
also of Virginia. We were extremely lucky 1


was sure they wanted to capture Powell. 2


It was a pleasant feeling. My body became extremely heavy 3




thanks a lot in advance

Ethen5155
10-14-2017, 09:24 AM
i give my shot and solved it, thx anyway




Const S_FIND As String = "↑"
Dim myNumber As Integer

myNumber = 1

Do While InStr(ActiveDocument.Content, S_FIND) > 0
With ActiveDocument.Content.Find
.ClearFormatting
.Text = S_FIND
.Execute Replace:=wdReplaceOne, ReplaceWith:="(" & myNumber & ")", _
Forward:=True
End With
myNumber = myNumber + 1 Loop