Visio Guy

Visio Discussions => Visio Bugs (er...Issues) => Topic started by: rsoby on March 16, 2009, 03:10:50 PM

Title: Problem Adding Command Button to Complex Drawings
Post by: rsoby on March 16, 2009, 03:10:50 PM
I have a rather complex drawing of a HW setup. I have a lot of server shapes (which came from a stencil and if you select it and ungroup it you get a lot of images, so I know there is a lot of complexity here) - but they are all from the same basic shape, just copied a lot and resized.  Also I have 11 layers and many shapes are on multiple layers ( differing views of the setup for users). I have killed off the document stencil, and removed the hidden information. When I look at the Layers window it says there is a total of 3750 shapes on the 11 layers ( again some layers have the same shapes as other layers)

Now when I try to add a command button - I get an error that says :
An error (1441) occurred during the action INSERT CONTROL
Visio cannot insert a new control because the file contains too many shapes, pages, or masters.
                                         OK

Have any of you run into this error? is there a way to correct it beyond what I've already done. or is it the case where there is a limit.....and I've hit it. the file is 1.5 megs in size ??

Any suggestions
Title: Re: Problem Adding Command Button to Complex Drawings
Post by: rsoby on March 16, 2009, 04:16:28 PM
Did some basic research - seems my base diagram was a Visio, that had been put into word. I grabbed it and put it back to Visio since I did not have the original. To do work on it I did an EDIT - SELECT ALL, and ungrouped it. So any text blocks became groups of text -  or at least that is how reacted - so something that was HTTPS ( 22 , 1470 ) - became HTTPS ,  ( , 22  ,  ","  , 1470  , and ) or 6 shapes. they may have used the line tool, but it seemed a bunch of lines (each as a shape) If you use the line tool, and draw a series of point to point lines (in many directions) and never completely stop, even with arrow points on each end.....it is one shape. If you lift the pen point, then each series of motions is a shape. well mine was a shape for each point, and a shape for each segment.

Now the server shape in visio ( SHAPES, NETWORK , SERVERs US, File Server) shows as 24 shapes, even though it is grouped -  I replaced all the now pieces of the server (from the ungroup), with the shape from the stencil, but it still is 24 shapes.  Adding text as part of the shape does not increase the shape count - so the text block must already be a part of the shape and when tested, a single box shape, with or witout text counts only as 1.

When you add data - you add 2 shape counts for each piece of data (one for the title, one for the actual data)

interesting that you can continue to add shapes to a file (I added data, and more servers) but at some magical count you cannot add controls.  So add your controls first and then add shapes - that works

Title: Re: Problem Adding Command Button to Complex Drawings
Post by: Visio Guy on March 17, 2009, 02:09:30 PM
I just did some tests with arrays of simple rectangles. The "can't add control 'cause there's too many shapes on the page" error seems to arise at somewhere between 1000 and 1100 shapes.

However, if you put the controls on the page first, then add thousands of shapes afterward, the buttons function just fine.

So the problem is just with creating the button controls when there are lots of shapes on the page. There is no inherent "VBA is broken at so many shapes" limitation.

Also, I was able to copy and paste controls just fine. So create your controls on a blank page, then copy them into the complicated drawing.
Title: Re: Problem Adding Command Button to Complex Drawings
Post by: Visio Guy on April 09, 2009, 11:12:38 AM
I just ran into a discussion about this in the German Visio newsgroups.

According to Dieter, who spoke to Microsoft, the problem goes like this:

The internal handling of controls is build such that the ShapeID of a control needs to be less than 1024. So if you already have 1024 shapes on the page (including sub-shapes of groups), these ids will no longer be available for your controls. Evidently MS can't do a hotfix without changing the file-format, so this problem will be with us for a while.

However, when shapes are deleted, Visio will try to recycle vacant ids. So there are a couple of solutions to this problem:

1. Make sure you put the controls on the page first (stop laughing)
2. Put a bunch of dummy shapes on the page first. These can be hidden or out of the way. When you need to insert a control, delete a dummy shape, then add the control in its place. The new control should take the old shape's id, which is less than 1024. Although doing this with VBA might pose some problems due to the need for idle-processing. I'm not sure about the details there.
3. Put as many shapes as possible on background pages to keep the number of shapes down (if this makes sense for your solution)
4. Make a new page by first adding controls, then copying the "old" page to the new one, thereby ensuring that the controls have the lowest-possible ids.


Title: Re: Problem Adding Command Button to Complex Drawings
Post by: JPL1711 on June 02, 2019, 10:57:33 AM
Not sure that anybody is still watching this post but I'll try anyway....

I've a similar problem with a diagram that I'm creating.  Many elements and layers and I'm trying to add command boxes to show / hide these layers.  Keep hitting the 1441 solution, even if I clear out shapes \ elements from any \ all of the pages.  Would like to sanity check the solution in a bit more lay mans terms before I start....

I've picked up the definition of controls from this link but it doesn't seem to link to the thread so I'm assuming that controls is proportional  to number of shapes in the document.  How do you apply the controls to the first page.....?
https://docs.microsoft.com/en-us/office/client-developer/visio/controls-row-controls-section

The approach I will take is:
Create a empty document (v2.0)
Put a few dozen dummy shapes on the first page
Copy and past from the v1 version to v2.0 and build up the diagram again on the first page.
If I hit 1441 error start removing dummy shapes.

Think that this will work....?