PDA

View Full Version : Math Type object problem



AlexandarR
09-22-2015, 08:51 AM
Hi All!:hi:

I am using a macro to find some text (20 million or 10 billion) and inserting a comment.

In the below mentioned case, there is a number followed by a Math Type Object, which contains only a entity "…". When I run this macro, comment is inserted. If I manually find "1 million" with wildcards ON, it is not find this occurrence. I don't know why this is happening... Please help me to understand and guide me to overcome!:help

<P>For passive monitoring applications, a typical way to increase the SNR of the coherent arrival of interest is to use longer averaging durations when computing the ambient noise cross-correlation waveform. Doing so, the low-SNR cross-correlation waveforms Yi(t) (i = 1[A1] (http://www.vbaexpress.com/forum/#_msocom_1) N) computed over short durations (a single epoch interval here) would be simply summed to yield the long-time average waveform (here across N epoch intervals):</P>
[A1] (http://www.vbaexpress.com/forum/#_msoanchor_1)CE: 'million' and 'billion' should be changed to 'x 106' and 'x 109'.




Sub a_counting()
Dim strFind() As String
Dim oRng As Range, oRngTag As Range, oRngLimit As Range
Dim lngIndex As Long
strFind = Split("([0-9]@) Million|([0-9]@) Billion|([0-9]@) million|([0-9]@) billion", "|")
Set oRng = ActiveDocument.Range
With oRng.Find
Do While .Execute(FindText:="\<P\>*\<\/P\>", MatchWildcards:=True)
For lngIndex = 0 To UBound(strFind)
Set oRngTag = oRng.Duplicate
Set oRngLimit = oRng.Duplicate
With oRngTag.Find
.ClearFormatting
.Replacement.ClearFormatting
.MatchWholeWord = True
Do While .Execute(FindText:=strFind(lngIndex), MatchWildcards:=True, Forward:=True, Wrap:=wdFindStop) = True
With oRngTag
If Not oRngTag.InRange(oRngLimit) Then Exit Do
.HighlightColorIndex = wdTurquoise
.Font.Color = wdColorPink
.Comments.Add oRngTag, "CE: 'million' and 'billion' should be changed to 'x 106' and 'x 109'."
.Collapse wdCollapseEnd
End With
Loop
End With
Next lngIndex
oRng.Collapse wdCollapseEnd
Loop
End With
lbl_Exit:
Exit Sub
End Sub