-1

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

Geographos
  • 827
  • 2
  • 23
  • 57

2 Answers2

2

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

Paul Herber
  • 1,150
  • 1
  • 7
  • 12
  • Or these shapes can have protected with [Guard function](https://github.com/MicrosoftDocs/office-developer-client-docs/blob/main/docs/visio/guard-function.md) font size cell. In this case you need use `FormulaForceU` [property](https://learn.microsoft.com/en-us/office/vba/api/visio.cell.formulaforceu) – Surrogate Apr 20 '23 at 04:15
  • When applied FormulaForceU instead of FormulaU, the result is unfortunately the same – Geographos Apr 20 '23 at 13:59
  • What result you mean: no changes or get error? If **No changes** then Paul's version is accurate! – Surrogate Apr 20 '23 at 14:30
  • Ok if so, how could I check, that my elements are grouped? It might be a good start point for my further solutions. – Geographos Apr 20 '23 at 14:59
1

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"

Surrogate
  • 1,466
  • 2
  • 11
  • 13