英文:
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
英文:
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
答案1
得分: 2
你的形状可能是组合的。你需要将你的公式应用于组内的形状。
英文:
Your shapes are probably groups. You need to apply your formula to the shapes within the group.
答案2
得分: 1
你必须使用绘图资源管理器窗口。在那里,你可以在树形视图中找到页面的内容。
在这种情况下,我们可以看到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
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"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论