Geographos
Geographos

Reputation: 1496

VBA visio - cannot change font size in the element

I am wondering why I see completely no reaction when trying to change the font size of the element.

My code is:

For Each Vshp In VPage.Shapes
    If Vshp.Name Like "*UG*" Then
        Debug.Print Vshp.ID & " - " & Vshp.Master.Name
        Vshp.CellsSRC(visSectionCharacter, 0, visCharacterSize).FormulaU = "12 pt"
    End If
Next

Both approaches from the below links don't work either:

How change the style of a shape-text in vba?

Changing font size in Visio through Visual Basic

enter image description here

Upvotes: -1

Views: 149

Answers (2)

Surrogate
Surrogate

Reputation: 1734

You must use Drawing Explorer Window.
There you cant find page's content in tree-view
ug

In this case we can see 4 sub-shapes into UG-shape…
If you need change font size for sub-shape with text NRTH-X-AF01AK you need change line Vshp.CellsSRC(visSectionCharacter, 0, visCharacterSize).FormulaU = "12 pt" to line Vshp.Shapes(4).CellsSRC(visSectionCharacter, 0, visCharacterSize).FormulaU = "12 pt"

Upvotes: 1

Paul Herber
Paul Herber

Reputation: 1200

Your shapes are probably groups. You need to apply your formula to the shapes within the group.

Upvotes: 2

Related Questions