Author Topic: ShapeSheet formatting to other obhects (text specific)  (Read 1795 times)

0 Members and 1 Guest are viewing this topic.


  • Newbie
  • *
  • Posts: 9
ShapeSheet formatting to other obhects (text specific)
« on: August 23, 2014, 02:17:27 PM »
This may have been asked before but I could not find a specific answer so here goes... I have a custom text formula:

=INT(TxtWidth*8)*1 pt

I use this to dynamically resize text as needed. I think I found that solution here. Anyway, I would like to take this attribute and apply it to a lot of text without having to go through each text box or shape individually and right click... Show ShapeSheet... Copy/Paste into the Size box. There are literally thousands of these text boxes and this seem too labor intensive.

Any suggestions?


  • Hero Member
  • *****
  • Posts: 2703
Re: ShapeSheet formatting to other obhects (text specific)
« Reply #1 on: August 23, 2014, 03:15:19 PM »
changing the formula of a cell is as easy as
shp.CellsSRC(visSectionCharacter, 0, visCharacterSize).FormulaU = YOURFORMULA

The question is which shapes need to be changed.
1) All?
for each shp in activepage.shapes
next shp

Here are some more options:

2) shapes defined by some cell value
Make sure that the cell exists, then check its value
For Each shp In ActivePage.Shapes
    If shp.CellExists("prop.something", visExistsAnywhere) Then
        if shp.Cells("prop.something", visSectionProp).ResultStr(visNone)=YOURIDENTIFICATOR then
    End If
Next shp

3) shapes that you want to select one by one
Create a non-modal form and catch new selections by means of the following procedure
Add a checkbox so you can pause the assigning.

Private WithEvents winObj As Visio.Window

Private Sub winObj_SelectionChanged(ByVal Window As IVWindow)
    Dim shp As Visio.Shape
    Dim sel As Visio.Selection
    Set sel = ActiveWindow.Selection
    sel.IterationMode = visSelModeSkipSuper
    If sel.Count > 0 And CheckAktiv.value Then
        Set shp = sel(1)
        setValue shp
    End If
End Sub

4) All shapes in a selection can be accessed by
for each shp in activewindow.selection

« Last Edit: August 23, 2014, 03:19:37 PM by Yacine »


  • Newbie
  • *
  • Posts: 9
Re: ShapeSheet formatting to other obhects (text specific)
« Reply #2 on: August 23, 2014, 03:43:51 PM »
It will be just for selected text blocks and objects with text properties. I was trying to go the macro route but that did not seem to be the solution. I'll give this a shot. Attached is part of the diagram in question. The Interface 1
Input has the correct text resizing code. The others do not.