mrezza
10-26-2015, 10:08 AM
Hi
I got below macro code from answers.microsoft site, but it errors while running.
Run-time error '424': Object Required
The red line of code is causing this error.
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oRng As Word.Range
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = "[0-9]{3,}"
.MatchWildcards = True
While .Execute
oRng.Select
If MsgBox("Do you want to format this instance", vbQuestion + vbYesNo, "FORMAT") = vbYes Then
oRng = Format(oRng, "#,##0")
End If
oRng.Collapse wdCollapseEnd
Wend
End With
End Sub
Any idea?
Best Regards.
I got below macro code from answers.microsoft site, but it errors while running.
Run-time error '424': Object Required
The red line of code is causing this error.
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oRng As Word.Range
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = "[0-9]{3,}"
.MatchWildcards = True
While .Execute
oRng.Select
If MsgBox("Do you want to format this instance", vbQuestion + vbYesNo, "FORMAT") = vbYes Then
oRng = Format(oRng, "#,##0")
End If
oRng.Collapse wdCollapseEnd
Wend
End With
End Sub
Any idea?
Best Regards.