VBA Visio – 无法更改元素中的字体大小

huangapple go评论70阅读模式
英文:

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.

我的代码是:

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:

https://stackoverflow.com/questions/58272955/how-change-the-style-of-a-shape-text-in-vba

https://stackoverflow.com/questions/45299242/changing-font-size-in-visio-through-visual-basic

VBA Visio – 无法更改元素中的字体大小

英文:

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:

https://stackoverflow.com/questions/58272955/how-change-the-style-of-a-shape-text-in-vba

https://stackoverflow.com/questions/45299242/changing-font-size-in-visio-through-visual-basic

VBA Visio – 无法更改元素中的字体大小

答案1

得分: 2

你的形状可能是组合的。你需要将你的公式应用于组内的形状。

英文:

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

答案2

得分: 1

你必须使用绘图资源管理器窗口。在那里,你可以在树形视图中找到页面的内容。

VBA Visio – 无法更改元素中的字体大小

在这种情况下,我们可以看到UG形状中有4个子形状...
如果你需要更改带有文本 NRTH-X-AF01AK 的子形状的字体大小,你需要将以下行更改为
Vshp.CellsSRC(visSectionCharacter, 0, visCharacterSize).FormulaU = "12 pt"Vshp.Shapes(4).CellsSRC(visSectionCharacter, 0, visCharacterSize).FormulaU = "12 pt"

英文:

You must use Drawing Explorer Window.
There you cant find page's content in tree-view
VBA Visio – 无法更改元素中的字体大小

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"

huangapple
  • 本文由 发表于 2023年4月20日 00:03:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/76056627.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定