此代码在Excel 2007中的字体大小列表组合框中打印出每个条目:

Sub FontSizeList()

Dim combo As CommandBarComboBox

Dim i As Integer
Dim j As Integer

For i = 1 To Application.CommandBars("Formatting").Controls.Count
    If Application.CommandBars("Formatting").Controls(i).Caption = "&Font Size:" Then
        Set ctl = Application.CommandBars("Formatting").Controls(i)
        For j = 1 To ctl.ListCount
            Debug.Print ctl.List(j)
        Next j
    End If
Next i

End Sub

但是,当我在PowerPoint 2007中运行相同的代码时,列表为空?如何在PowerPoint VBA中进行字体大小组合框进行Intial iNTIAL?我已经检查了两个字体大小属性“可见”和“已启用”,并且它们都设置为true。

非常感谢

有帮助吗?

解决方案

我在Excel和PowerPoint 2007上尝试了您的代码。

在PowerPoint上,如果未选择文本bloc(或绘图),则FONTLIST和FONTSIZE是不可选择的(深灰色)。这可以解释为什么调试时列表数仍然为0。

这也可以解释为什么它在PPT 2003上确实有效,因为您没有功能区,也许已经选择了Fontsize和FontList。

不幸的是,即使选择了一个集团文本,我也没有设法拥有listCount>0。我必须进一步研究它。

最大限度

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top