Count occurances of a character string? 
Author Message
 Count occurances of a character string?

Hi,

I want to count the occurances of a text string in a visio
drawing.  I am currently counting the number of times I do
a 'Find Next' command.

Thanx,

Jerry



Sat, 03 Dec 2005 01:40:09 GMT  
 Count occurances of a character string?
Jerry,

You could write a VBA macro to handle this. Two things to keep in mind:

A shape object has a .Text property that you can analyze. For instance

Dim visShp as Visio.Shape
For Each visShp in ActivePage.Shapes
    MsgBox visShp.Text
Next

If a shape is a group, you may have to recurse through the member shapes to
find more text.

Sub RecurseText( visShp as Visio.Shape )
    Dim visShpSub as Visio.Shape
    MsgBox visShp.Text
    If visShp.Type  = -group- Then                    'Find actual visConst
for type group...
        For Each visShpSub in visShp.Shapes
                Call RecurseText( visShpSub )          'Recurse
visShp.Shapes
        Next
    End if
End Sub

Hope this helps,

Chris Roth
Visio MVP


Quote:
> Hi,

> I want to count the occurances of a text string in a visio
> drawing.  I am currently counting the number of times I do
> a 'Find Next' command.

> Thanx,

> Jerry



Sat, 03 Dec 2005 20:32:35 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. counting occurances of a string in a field

2. Count number of occurances in table

3. counting occurances of word in text file?

4. Counting Number of Occurances ?

5. Function for counting occurances

6. Change all occurances of a character

7. counting characters in a string

8. Counting Characters in a string

9. Finding & Counting Certain Characters in a string

10. return the count of a particular character in a string

11. Count characters in a string

12. Count Upper Case characters in a string

 

 
Powered by phpBB® Forum Software