You can resize the font of the text block using automation if the text exceeds the size of the shape. I found that the following works.
Open the shape's shapesheet (Window->Show Shapesheet) and add the user section (Insert->Section->User-defined Cells). Put this formula in the value cell for User.Row_1:
=Min(1,Height/TEXTHEIGHT(TheText,Width)))
After the shape text changes, get the value of the user cell. in c#:
double scale = shape.get_CellsSRC((short)IVisio.VisSectionIndices.visSectionUser, (short)IVisio.VisRowIndices.visRowUser, (short)IVisio.VisCellIndices.visUserValue).ResultIU;
Then set the font, and the TextMargins (for any that are non-zero) with the following (assuming the normal font size is 12 and the left margin is 4pt.:
shape.get_CellsSRC((short)IVisio.VisSectionIndices.visSectionCharacter, 0, (short)IVisio.VisCellIndices.visCharacterSize).FormulaU = (scale*12).ToString() + "pt";
shape.get_CellsSRC((short)IVisio.VisSectionIndices.visSectionObject, (short)IVisio.VisRowIndices.visRowText, (short)IVisio.VisCellIndices.visTxtBlkLeftMargin).FormulaU = (scale * 4).ToString() + "pt";
Awesome help, thanks!
I improved the code a bit, which means you don't have to hard code the shape name.
Instead use this macro:
Sub EditObject()
Dim s As Shape
Set s = ActiveWindow.Selection.PrimaryItem
s.OpenDrawWindow.Activate
End Sub
Save this Macro just as you have. Go into the "Behavior" (on the Developer tab) of the shape you want to edit, and change the Double-Click (tab 2) to "Run Macro", and select your macro.
Now, double clicking on the shape should bring up the edit window.
Best Answer
I asked this question directly to the Program Manager of Visio 2010 at Microsoft during an internal MS event on campus and the answer was: "This is not possible". I have been missing this feature since Visio 2003 and hope that it will be finally added in the next version of Office.