Strange Behaviours

V

VKY

Hi All,

I have a shape with 2 connection points (shpMain), and I wanted to add a
text shape (shpText), group them and drop them onto a stencil, all
programmatically.

I also wanted the connection points on shpMain to be on the group level.
Meaning, if I select shpMain, and then select shpText:

ActiveWindow.Select shpMain, visDeselectAll + visSelect
ActiveWindow.Select shpText, visSelect
ActiveWindow.Selection.Group

then I will have a grouped shape where if you view the ShapeSheet, you
will not see any connection point section. You will only see the
connection point section only when you view the ShapeSheet for shpMain
within this group.

Therefore I have the following code, using ConvertToGroup:

shpMain.ConvertToGroup
ActiveWindow.Select shpMain, visDeselectAll + visSelect
ActiveWindow.Select shpText, visSelect
ActiveWindow.Selection.AddToGroup

then when I view the grouped shape using ShapeSheet, I will be able to
see the connection point section. This works fine.

The problem is when, after the codes above, I tried to create a blank
stencil and add this group to the stencil:

Visio.Application.DoCmd visCmdFileNewBlankStencil
Set Doc = Documents(Documents.Count)
Set tMaster = Doc.Drop(shpMain, 32000, 32000)

Using the codes from above, everything works fine without generating any
errors, except that the shape added/dropped onto the stencil is blank,
with nothing. Dragging the shape from the stencil onto a page generates
an error that says "The Master is empty, nothing will be created". (313)

Can anybody explains why?

Thanks.
 
M

Mark Nelson [MS]

The code you have here works when I try it. As you discovered, the Group
command creates a new shape and puts shpMain inside it. ConvertToGroup is
the proper command to keep shpMain as the topmost shape.
 

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