Copying a shape group creates an invalid object

H

Hakyab

A problem occured when I tried to copy a shape group in VBA(Excel 2007). This
is what the code looks like

workbooks(1).shapes("name").parentgroup.copy
workbooks(2).activesheet.paste

Visually this works as intended, I see the same group of shapes in workbook
2. GroupName.GroupItems list the correct shapes, however, the CHILD property
of individual shapes are now set to 0. I get an error when I try to access
the group:

workbooks(2).shapes("name"),parentgroup <-- gives "runtime error 1004,
subscript out of range."

Is there a better way of doing this? Should I just copy the shapes and set
their positions manually? (I needed to keep relative positions of the boxes
fixed, that is why I tried throguh a group)
 

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