Retrieve the shape resulting from a selection.group

Y

YvesP

Hi,
I'm writing an application to generate visualisations of connections
between some software components. To accomplish this, I have to runtime
build some shapes consisting of a different parts. After creating and
clearing a selection object, I add the different shapes to the
selection that make up the composite drawing. Dispite of what the help
in MSDN says, the 'Group' method does not return the resulting shape.
Can anyone tell me how I can get a hold of the grouped shape? Next is a
code snippet that should give an idea what I am trying to accomplish:
Dim lSelection As Selection

Set lSelection = lv_Application.ActiveWindow.Selection
lSelection.Delete 'empty the selection
...
Call lSelection.Select(lv_SomeShape part)
Call lSelection.Select(lv_SomeShape part)
lSelection.Group 'lv_ResultShape = lSelection.Group is incorrect
... ' ?? what is the resulting shape??
Thanks in advance for any support on this.
Regards.
Yves
 
D

David Parker [Visio MVP]

This works:

Dim win as Visio.Window
Dim lSelection As Selection
Dim grp As Visio.Shape

Set win = ActiveWindow
If win.Selection.Count > 0 Then
win.DeselectAll
End If
win.Select Visio.ActivePage.Shapes(1), Visio.visSelect
win.Select Visio.ActivePage.Shapes(2), Visio.visSelect
Set lSelection = win.Selection
Set grp = lSelection.Group
 
Y

YvesP

Hi David,
thanks for your support.
I still get an error 'Expected variable or function' on the 'Set
grp=lSelection.Group' command, highlighting the 'Group'.
I just realised I should check to see if this might have something to
do with the version I'm using, which is Visio2000 SR1. Maybe the
functionality has been added and this also might justify the difference
between the run time behaviour and the MSDN help, which states that the
Group method returns the resulting shape.
Regards
Yves
 
Y

YvesP

The typelib in Visio2003 indeed shows that the signature of 'Group' has
changed and that it returns the shape in the newest version. I
installed Visio2003 but vislib.dll returns an error 0x80004001 upon
registration. Anyone any idea how to overcome this. I can run the
Visio2003 version interactively though.
Thanks a lot.
Regards.
Yves
 

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