Resize of shape doesn't work

I'm adding the same text box to every submodel.

The shape has a default size of 70x70 and I need it to be bigger (100x90) to see all the text.

The problem is, on some submodels, after changing the size I see 100x0 and sometimes 0x0 rather than the size I set. 
Once in a while the size is correct but mostly it collapses the shape so you can't see it at all.

Anyone know what's wrong (is it me or the app)?

        ' Add a text box object (shape) if it doesn't exist already
        Set ColorKeyShape = M.Shapes.Item(ColorKeyShapeName)
        If ColorKeyShape Is Nothing Then
            Set ColorKeyShape = M.Shapes.Add(ColorKeyShapeName,ColorKeyText,1)
        Else
            ColorKeyShape.Text = ColorKeyText    ' insure text is up-to-date
        End If

        ' Add the shape to every submodel
        For Each S In M.SubModels
            Debug.Print "SubModel = " + S.Name

            ' Add it if it doesn't exist
            Set ColorKeyDisplay = S.ShapeDisplays.Item(ColorKeyShape.Name)
            If ColorKeyDisplay Is Nothing Then _
                Set ColorKeyDisplay = S.ShapeDisplays.Add(ColorKeyShape.Name)

' Resize it so people can read all the text ColorKeyDisplay.HorizontalSize = 100 ColorKeyDisplay.VerticalSize = 90 Debug.Print ColorKeyDisplay.HorizontalSize Debug.Print ColorKeyDisplay.VerticalSize Next
Parents
  • Having done extensive testing it really doesn't seem reasonable that this could be anything but a bug.  The Debug.Print statements show that the values do not get updated by the statements that attempt to update them and, upon manual resizing thru the GUI, both size values show the new GUI defined values.  Moreover the actual size, if not set by the GUI, appears to depend in part on the existence of other shape display items and whether an attempt to change their size has ever been made - even in other edit sessions.  IOW if the shape itself is newly added to the model the behavior of the first shape display item based on that shape is different than the 2nd or 3rd shape display item.  Once you try to set the size of a shape display item via macro all subsequent display items based on that shape have aberrant sizes and cannot be changed via macro code.  

Reply Children
No Data