Sub sucheP()
Dim Alltext As String, found As String
Dim x As Long, e As Long, s as Long,erg As Long
sAlltext = ActiveDocument.Content
e = 1
s = 1
Do
s = InStr(e, sAlltext , "P(", vbTextCompare)
If s = 0 Then Exit Do
e = InStr(s, sAlltext , ")", vbTextCompare)
If s = 0 Then Exit Do
found = Mid(sAlltext , s + 2, e - (s + 2))
erg = erg + CLng(found)
Loop Until s = 0 And e = 0
MsgBox erg
End Sub
|