Collection turns Connect objects into Shapes?

M

Mac

Dim myConns As New Collection
Dim connxCol As Visio.Connects
Dim myConnect As connect, anotherConnect As Connect
Dim whyShape As Shape

Set connxCol = ActivePage.Connects
For Each myConnect In connxCol
myConns.Add myConnect
Next myConnect

For Each anotherConnect In myConns = HERE I GET 'Type Mismatch Error'
..
Next anotherConnect

For Each whyShape In myConns = THIS ONE LOOPS OK
..
Next whyShape

Why are Connect objects turned into Shape objects and how do I prevent this?
 
P

Paul Herber

Dim myConns As New Collection
Dim connxCol As Visio.Connects
Dim myConnect As connect, anotherConnect As Connect
Dim whyShape As Shape

Set connxCol = ActivePage.Connects
For Each myConnect In connxCol
myConns.Add myConnect
Next myConnect

For Each anotherConnect In myConns = HERE I GET 'Type Mismatch Error'

myConns is a collection
anotherConnect is of type Connect
 
M

Mac

Ok, so how do I define a Collection-Of-Connect-Types type? I've believed that
collection is a type-less container ...
 
J

John... Visio MVP

Mac said:
Dim myConns As New Collection
Dim connxCol As Visio.Connects
Dim myConnect As connect, anotherConnect As Connect
Dim whyShape As Shape

Set connxCol = ActivePage.Connects
For Each myConnect In connxCol
myConns.Add myConnect
Next myConnect

For Each anotherConnect In myConns = HERE I GET 'Type Mismatch Error'
.
Next anotherConnect

For Each whyShape In myConns = THIS ONE LOOPS OK
.
Next whyShape

Why are Connect objects turned into Shape objects and how do I prevent
this?


Try just using Visio.* objects rather than collections and connect. (use
VISIO.connect)

John... Visio MVP
 
P

Paul Herber

Ok, so how do I define a Collection-Of-Connect-Types type? I've believed that
collection is a type-less container ...

as John says, and as you have for your conncCol, set the type to
Visio.Connects
 

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