【发布时间】:2011-06-10 09:14:29
【问题描述】:
此代码打印出 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 中初始化字体大小组合框?我检查了字体大小属性 'Visible' 和 'Enabled',它们都设置为 True。
非常感谢
乔
【问题讨论】:
-
你没有使用
Option Explicit吗?如果没有,那你确实有一天会后悔的…… -
刚刚在 PowerPoint 2003 中运行它,在那里工作正常...
-
谢谢,是的,我正在使用“选项显式”。我正在使用 Powerpoint 2007
标签: vba powerpoint