私はPowerPoint 2010でドロップダウンリストを作成しました。これは、ドキュメントを保存する前に非常にうまく機能します。VBAで次のコードを使用しました。
Sub AddItemsToSelectedListBox()
Dim oShape As Shape
Set oShape = ActiveWindow.Selection.ShapeRange(1)
With oShape.OLEFormat.Object
' Add items to the list
.AddItem ("Good")
.AddItem ("Better")
.AddItem ("Best")
' You could work with other properties of the list or combo box here as well
End With
End Sub
f5 +閉じる。
ビューモードに移動すると、ドロップダウンリストが適切に機能します。しかし、パワーポイントドキュメントを(.pptm形式で)保存してプレゼンテーションを再度開くと、リストがドロップダウンしなくなります。VBAを入力すると、コードは次のようになります。
Sub AddItemsToSelectedListBox()
Dim oShape As Shape
Set oShape = ActiveWindow.Selection.ShapeRange(1)
With oShape.OLEFormat.Object
' Add items to the list
.AddItem ("Good")
.AddItem ("Better")
.AddItem ("Best")
' You could work with other properties of the list or combo box here as well
End With
End Sub
Private Sub ComboBox1_Change()
End Sub
ComboBox_Change()パーツは新しいものです。(なぜですか?)保存プロセスを生き残るドロップダウンリストを生成する方法を知っている人はいますか?どうもありがとうございました!!
コンボボックスをダブルクリックしてVBEに入ると、_Changeサブルーチンが追加されます。
モジュール内のサブルーチンからコンボボックスをロードした場合、保存して再度開いたときに値が保持されていないようです。
ボックス自体のイベントからコンボボックスをロードすると、期待どおりに機能するようです。
例えば:
Private Sub ComboBox1_GotFocus()
Dim oShape As Shape
Set oShape = ActivePresentation.Slides(1).Shapes("ComboBox1")
With oShape.OLEFormat.Object
.Clear
' Add items to the list
.AddItem ("Good")
.AddItem ("Better")
.AddItem ("Best")
' You could work with other properties of the list or combo box here as well
End With
End Sub
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加