Visio2013 – Auto Sizing Text Boxes


Purpose:  This article provides the steps for creating text boxes in Visio 2013 that auto resize when as their text changes.

Problem:  By default the text box stencil can only be sized and re-sized by dragging its control handles as needed with a mouse or by entering the exact measurements into the height and width fields in the shape-sheet.

Unfortunately, the subsequent problems are that a) this methodology must be executed for each text box created by the user and b) when the text inside the box is altered, the size of the text box will stay the same until the user manually resizes it again.

Lastly while the procedures for auto sizing text box can be found on the net, the instructions lack the additional steps needed by beginners.

Solution:  User-program a text box so it resizes conveniently and then save that customized text box as a personal stencil for re-use conveniently.

Steps are broken into 4 phases.  Initially, they sound complex. But after you are finished, you will find that it was pretty easy.  Therefore, I suggest to first read the steps from beginning to end in order to get a general idea.  Afterwards, implement the steps.

Phase 1 – Create the custom text box

  • Create a blank diagram.
  • Create a text box via the standard method and size it to any size such as 2 inches by 4 inches. (remember, that in the future, this initial size will auto-size later.
  • Next set the text box border to a black line. This will be visually helpful to distinguish your custom box’s from the standard boxes that have no lines.
  • Next add some text inside the empty box, such has Auto Size Box.

Phase 2 Program the custom text

  • Right click on Ribbon Menu and select Customize
  • In right side panel Enable Developer mode, click apply and then exit this mode
  • Under the newly visible Developer Menu option click Show Shape-sheet. (Incidentally, ensure the sample text box is still active and its control handles are visible to ensure the shape-sheet is for the text box)
  • Inside the Shape-sheet window scroll down to the section called Shape Transform and find the fields called Width and Height.
  • In the Width Field copy and paste the code in the next line. Afterwards press the enter key to set it:

=TEXTWIDTH(TheText)

  • Next select the Height Field then copy and paste the next code. Afterwards press enter key to set it:

=TEXTHEIGHT(TheText,999)

  • Note: You can also type the above codes into the fields with your keyboard.
  • Next, close the Shape-sheet and return to your diagram.

Phase 3:  Testing the text box

  • Now test your newly programmed text box by modifying the text inside it.  The box should increase and decrease in size automatically.   Note: If the box isnt resizing then double check the formula’s in the fields and ensure they begin with an equal sign and end with a parenthesis.

Phase 4: Saving the customized text box as a reusable stencil

  • Open the Shapes Stencil.  Note: If Shape Stencil has disappeared, then click on Menu View, Task Pane and then Shapes
  • Click on More Shapes and then on New Stencil
  • Next drag your custom text box from the diagram and into the stencil area where it cites “drop quick shapes here”
  • Next rename the your custom shape by right clicking on it and then “renaming’. Call it anything you’d like it for be.
  • Next click on the Save Icon. Note: There is a tiny Save Icon at the end of the Title bar for the newly created stencil.
  • For the file name to save this personal stencil use any name you like for it.  However, I suggest to begin the file name with the number zero.  In doing so, your personal stencil will appear at the top of the long list of stencils on the menu because of the number zero.

~ End of this article ~

Advertisements