Hello!
Please, can someone help me how to write PROGRAM (macro-edit) which recognises certain (decimal) number in the text?
I don’t quite understand your question, but a macro to search for numbers in the text of the document can be as
Sub searchDigitsInText
Dim oSDescriptor As Variant ' Search descriptor
Dim oSearchResult As Variant ' Result of "Find all"
Dim nCount As Long ' Count of results
Dim i As Long ' Index
Dim s As String ' String to message
oSDescriptor = ThisComponent.createSearchDescriptor()
oSDescriptor.setSearchString("\d\d*(\.|,)?\d*")
oSDescriptor.setPropertyValue("SearchRegularExpression",True)
oSearchResult = ThisComponent.findAll(oSDescriptor)
nCount = oSearchResult.getCount()
If nCount = 0 Then
MsgBox("Not found any digits in this text")
Else
S="Found " + nCount+ " values:" + Chr(10)
For i = 0 to nCount-1
S = S + oSearchResult.getByIndex(i).getString() + " "
Next i
MsgBox(S)
EndIf
End Sub
Thanks!!!
Please, how can we make macro searching 3-places numbers (abc) like 445, 983 etc?
Sorry, not english, tryinng in teh meantime!!!
if we have 3 numbers in the text nCount =3???