BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Box that resizes in function of the a seperate textfield.

Started by plinius, November 17, 2010, 06:11:07 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


I hope this is the right place to post my question, if not please let me know...

I'm trying to make a diagram in visio which gets another form in function of several parameters.
To get it started I tried an easy example where I put in X and Y as a text field, and draw on another place a box with height  X and width  Y.

But I didn't succeed (in fact I don't even know where to start).
If possible I want to avoid embedded Excel  and VBA (the sheet should be used by other persons without changes in the default security settings).

Where can I start with this? A "general sample" is OK (I found nothing on internet although I searched quite a bit)...
Thanks in advance.

Paul Herber

Here's an example:
Drop a shape on the page, then menu Shape -> Shape Data (or Custom Properties in older version of Visio), define a property called width and set the type to Number and the Format to Floating with units. Set the value to the initial width you require, say 4cm. Now with the shape still selected, open its shapesheet (menu Window -> Show Shapesheet) and edit the Width cell, remove the current value, type an '=' then click on the width cell in the custom properties section.
Now you have a shape where the width is controlled by the value in the custom properties.
Oh yes, you'll also need to add a guard(..) around the formula you entered above.
Electronic and Electrical engineering, business and software stencils for Visio -


Thanks, this works indeed!
However this links a "shape data" to the form of the shape, but when I add a text field (using the Text tool from the toolbar) I cannot find the value of the text I just typed in the shapesheet.  So I cannot immediately link the text field with the box size...

I discovered in another post that I can make also "shape data" for the textfield, which I put on "shapetext(TheText)".
I guess I can put the Width en Height of the box equal to a "shape data" of another shape.
But here the problem is that the shape data for the text should be of the string type, and a Width is a float. So I'm still stuck..

(Sorry, but as you can see I'm still learning Visio)


Try this formula instead:  =GUARD(SHAPETEXT(TheText)).

This assumes that your shape text that was entered is simply a number, e.g., 12.  But, this will only do a single value, not separate values for width and height.

You may want to check out this link regarding shapesheets:

Visio 2019 Pro


Thanks, found it when you were typing your replie  ;D.


Does indeed the trick.

Thanks for the link also.


You can do a variation of Paul's suggestion, but text entry is not straight forward typing.

Create two custom properties, one for width (X) and one for height (Y).  As Paul indicated, you can enter the appropriate formula for width and height cells.  Note, if you keep the property as a string, I believe the shape assumes the sheet proporties for dimensions.

Now to have your values show in the shape, with the shape selected, go to Insert > Field, and select custom.  Assuming that the two properties were called prop.wid and, then, in the custom formula, enter ="Width: "&Prop.Wid&CHAR(10)&"Height: "&Prop.Ht.  Note, you could eliminate the "Width: "& and the "Height: "& if all you want to show are the values.  char(10) is linefeed.  

But, to maintain everything, the values should not be typed in directly into the shape, but entered thru the custom properties menu.


Visio 2019 Pro


Thanks Wapperdude and Paul.

Glad I found this forum, I learned a lot in a few hours !



In case you don't already know. In the menu "View" (Visio 2007, don't know where to find in 2010) you find a option "Shape Data Window". This opens a "all the time visible" Window with the Shape Data, where you can directly see and manipulate the ShapeData. With that open, there is no need for Text Boxes I think.

If you still want to see the selected options on a print out, you can creare a user defined cell, that contains all the Info and display that in a (seperate) textbox, using Insert->Field and selecting the user defined cell. The cell could contain a formula like:

="Width: " & Prop.Wid & CHR(10) & "Height: " & Prop.Ht & CHR(10) & .....


Thanks, hadn't discovered this one indeed  :)

I have one more minor question:
When I create a box with a calculated length, it is always referenced around a certain middle point. So if I want the box to START at a certain PinX I always have to come up with pretty annoying formulas to do the trick. It's not that hard, but I imagine there should be a more elegant way (e.g. making a box which has it reference point on the left side instead of in the middle, or somewhere in the shapesheet setting a value between  guard(..),...)

I tried some of these, but I had no luck so far, so...

Paul Herber

Electronic and Electrical engineering, business and software stencils for Visio -


In the ShapeSheet you find LocPinX and LocPinY. If you imagine PinX and PinY as the point, where a needle pins your  shape to the paper, than LocPinX/Y defines the point on the shape, where the needle wents through.

Set both to 0 for the shapelength and -height to start in the bottom left corner.


For an illustration of what "Pin" vs "LocPin" does, see VisioGuy's blog entry, Pin and LocPin Illustration, found here:  You will need to scroll down quite aways.

Visio 2019 Pro


Thanks all for your replies. The visio drawing with Pin and loPin all made it clear. I finally understand now.

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 383 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1214KB.
Tokens: post-login.
Cache hits: 13: 0.00123s for 26,767 bytes (show)
Cache misses: 2: (show)
Queries used: 15.

[Show Queries]