AW: Verschiedene Texte zählen lassen
30.04.2009 18:08:51
Tino
Hallo,
habe mal etwas in die Trickkiste gegriffen.
Sub TextBox20_KlickenSieAuf()
Dim myShape As Shape
Dim myArText
Dim tempStr As String
Dim i As Integer, iCount As Integer
Dim objRegEx As Object
Set objRegEx = CreateObject("VBScript.RegExp")
With Tabelle1
Set myShape = .Shapes("Text Box 20")
tempStr = myShape.DrawingObject.Text
With objRegEx
.MultiLine = True
.Global = True
.Pattern = ": [0-9]"
tempStr = .Replace(tempStr, "")
End With
myArText = Split(tempStr, vbLf)
If Ubound(myArText) > 0 Then
For i = Lbound(myArText) + 1 To Ubound(myArText)
For Each myShape In .Shapes
If myShape.Type = 17 Then
If myShape.Name <> "Text Box 20" Then
If myShape.DrawingObject.Text Like myArText(i) Then iCount = iCount + 1
End If
End If
Next myShape
myArText(i) = myArText(i) & ": " & iCount
iCount = 0
Next i
End If
tempStr = Join(myArText, vbLf)
.Shapes("Text Box 20").DrawingObject.Text = tempStr
End With
End Sub
Kommst Du damit zurecht?
Gruß Tino