find a shape via name

A

a.corrieri

Hi!

I try to do the following: on a page walk the shapes and delete some of them
having a name pattern.

I walk the list via

For intCounter = 1 To intShapeCount
myStr = vsoShapes.Item(intCounter).Name
Next intCounter

now I would like to do something like:

if myStr.StartsWith("Sheet.") Then
...

unfortunatly I haven't found a way to use StartsWith

any ideas?

thanks
Alex
 
D

David Parker [Visio MVP]

...or
if left(myStr,6) = "Sheet." Then

BTW - Shapes can be renamed in Visio ...
 
M

Markus Breugst

Hi Alex,

I think the problem is that you are using the "Name" property. You should
use "NameID" instead.
You can test the difference with the following macro.

Best regards,
Markus

Public Sub NameVersusNameID()
Dim myshapes As Shapes
Dim myshape As Shape
Dim index As Integer

Set myshapes = Pages(1).Shapes
For index = 1 To myshapes.Count
Set myshape = myshapes(index)
Debug.Print ("Name = " + myshape.Name)
Debug.Print ("NameID = " + myshape.NameID)
Debug.Print ("-----")
Next index
End Sub
 
A

a.corrieri

Thank you, and that nameID was helpful too, I wondered what the difference
was until now :(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top