使用 Visio VBA 设置容器字体大小

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

Set Container font size using Visio VBA

问题

I have code that is generating containers for a VBA diagram. I need to specify the font size for each container from VBA. For container shape con, I'm trying:

con.Cells("Char.Size").FormulaForceU = "8 pt"

This will cause the font size drop-down in the Visio UI to update to 8pt as well as the cell value in the shape sheet, but it does not actually change the font size for the container. I can change the size manually without issue.

Is there a step I am missing here?

英文:

I have code that is generating containers for a VBA diagram. I need to specify the font size for each container from VBA. For container shape con, I'm trying:

con.Cells("Char.Size").FormulaForceU = "8 pt"

This will cause the font size drop-down in the Visio UI to update to 8pt as well as the cell value in the shape sheet. but it does not actually change the font size for the container. I can change the size manually without issue.

Is there a step I am missing here?

答案1

得分: 1

容器形状 包含一些子形状!
在这个例子中,您可以看到一对子形状。它们每个都有自己的单个子形状...
通常,容器中有4-5个子形状的摘要。

您必须定义容器的结构,并找到 'Header' 形状的索引

con.Shapes(2).Cells("Char.Size").FormulaForceU = "8 pt"

这是针对索引为2的子形状的示例。

这将导致 Visio UI 中的字体大小下拉框更新为8pt,以及形状表中的单元格值。

当您使用 UI 进行更改时,将应用于容器和所有子形状。但通过 ShapeSheet,您只能更改单个(活动)形状!

英文:

Container shape consist of some sub-shapes!
In this example you can see into pair of sub-shapes. Each of them have own single sub-shape…
使用 Visio VBA 设置容器字体大小
Usually container have into 4-5 sub-shapes summary.

You must define structure of your container, and find index of 'Header' shape

con.Shapes(2).Cells("Char.Size").FormulaForceU = "8 pt"

This example for sub-shape with index = 2.


> This will cause the font size drop-down in the Visio UI to update to 8pt as well as the cell value in the shape sheet.

When you use UI changes apply for container and all sub-shapes. But via ShapeSheet you can change only single (active) shape!

huangapple
  • 本文由 发表于 2023年5月22日 19:42:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/76305818.html
匿名

发表评论

匿名网友

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

确定