M
Marty
Howdy All,
There are many spots where my routines draw a graphic (such as an oval or a rectangle) and then sets up an object to track that graphic. For example, at some later point the code might need to change the forecolor of all shapes held in AShapesSubset collection. A problem arises if the user should delete or group one of the shapes represented in the AShapesSubset collection. The collection's pointer for the affected shape is no longer valid, and any attempt to change the forecolor produces an error.
Is there a "best practice" means of tracking shapes? I wish that shapes had events associated with them; e.g. "ShapeDeleted" and a "ShapeGrouped" events. It appears that this is not the case (at least in Word 2000). Alternatively, is there a way to alter Word's Delete and Group routines so that I can first inspect the ShapeRange affected and post my own event? I can, of course, write code that would search through all Shapes and all GroupShapes to check on a shape's status. But that seems like quite a lot of overhead to encompass every single time I need to refer to a shape.
Marty
There are many spots where my routines draw a graphic (such as an oval or a rectangle) and then sets up an object to track that graphic. For example, at some later point the code might need to change the forecolor of all shapes held in AShapesSubset collection. A problem arises if the user should delete or group one of the shapes represented in the AShapesSubset collection. The collection's pointer for the affected shape is no longer valid, and any attempt to change the forecolor produces an error.
Is there a "best practice" means of tracking shapes? I wish that shapes had events associated with them; e.g. "ShapeDeleted" and a "ShapeGrouped" events. It appears that this is not the case (at least in Word 2000). Alternatively, is there a way to alter Word's Delete and Group routines so that I can first inspect the ShapeRange affected and post my own event? I can, of course, write code that would search through all Shapes and all GroupShapes to check on a shape's status. But that seems like quite a lot of overhead to encompass every single time I need to refer to a shape.
Marty