In excel (2003) I have some objects. They each consist of a set of 4 textboxes which have been grouped into one object. In other words I have multiple objects, each of which consists of a grouped set of four text boxes.
I am trying to put connectors between them in code.
I recorded a macro in which I did this to one pair of the objects.
When I run the macro, it crashes.
If I create a couple of simple textboxes (not grouped) and record the macro whilst connecting those, it runs OK.
Here is the code I recorded while connecting the grouped items:
This is the macro I recorded while connecting just the simple text boxes:
Note that the names of the grouped items are Grp_Pd and Grp_NETD50 NOT bx_Pd_4 and bx_NETD50_4. Instead bx_Pd_4 and bx_NETD50_4 are the names of two of the individual text boxes which make up Grp_Pd and Grp_NETD50 respectively.
So the problem seems to be that when I manually make connections, they can connect grouped items because Excel recognises that the sub-items (the internal textboxes) exist, whereas when I do the same thing in code, excel does not recognise that the internal items exist.
I'm a bit stumped. Does anyone have any clues as to how to connect grouped objects?
Tony
I am trying to put connectors between them in code.
I recorded a macro in which I did this to one pair of the objects.
When I run the macro, it crashes.
If I create a couple of simple textboxes (not grouped) and record the macro whilst connecting those, it runs OK.
Here is the code I recorded while connecting the grouped items:
Code:
Sub setconnections()
ActiveSheet.Shapes("AutoShape 111").Select
Selection.ShapeRange.ConnectorFormat.BeginConnect ActiveSheet.Shapes("bx_Pd_4"), 4
Selection.ShapeRange.ConnectorFormat.EndConnect ActiveSheet.Shapes("bx_NETD50_4"), 2
End Sub
This is the macro I recorded while connecting just the simple text boxes:
Code:
Sub test_box_connections()
ActiveSheet.Shapes("AutoShape 111").Select
Selection.ShapeRange.ConnectorFormat.BeginConnect ActiveSheet.Shapes("Text Box 113"), 4
Selection.ShapeRange.ConnectorFormat.EndConnect ActiveSheet.Shapes("Text Box 114"), 2
End Sub
Note that the names of the grouped items are Grp_Pd and Grp_NETD50 NOT bx_Pd_4 and bx_NETD50_4. Instead bx_Pd_4 and bx_NETD50_4 are the names of two of the individual text boxes which make up Grp_Pd and Grp_NETD50 respectively.
So the problem seems to be that when I manually make connections, they can connect grouped items because Excel recognises that the sub-items (the internal textboxes) exist, whereas when I do the same thing in code, excel does not recognise that the internal items exist.
I'm a bit stumped. Does anyone have any clues as to how to connect grouped objects?
Tony