Excel VBAでPowerPointプレゼンテーションを作成しています。
私は配置しようとしています次と前各スライドのボタン。私は以下のコードを使用しています:PowerPoint VBAでボタンを作成してもクリックできない
Dim ppApp As PowerPoint.Application, ppPres As PowerPoint.Presentation, ppSlide As PowerPoint.Slide
Dim shpNextButton As PowerPoint.Shape
Set ppApp = CreateObject("Powerpoint.Application")
Set ppPres = ppApp.Presentations.Open("C:\Users\test1.pptm")
Set ppSlide = ppPres.Slides.Add(ppPres.slides.count + 1, ppLayoutBlank)
Set shpNextButton = ppSlide.Shapes.AddShape(msoShapeActionButtonForwardorNext, 750, 480, 40, 12.5)
With shpNextButton.TextFrame.TextRange
.Text = "Next"
With .Font
.Size = 10
.name = "Arial"
End With
End With
shpNextButton.ActionSettings(ppMouseClick).Action = ppActionNextSlide
このコードは、正しいテキストでボタンを作成します。ただし、PowerPointスライドでは、このボタンはクリック可能です。クリックすると、通常の形のように機能します。
:で、この潜在的な問題を回避するために、オフセット少ない側の右側を参照する方が良いでしょう= 1)と 'PowerPoint.ppActionNextSlide'(= 1)?しかし、私はレイトバインディングを使用して、それが別のコンピュータにあるときに問題を防ぐために値でPowerPointの特定の定数を置き換えることをお勧めします。 – PatricK
ヒントをありがとう。私は自分のコードでレイアウトアクションの設定とアクションを持っています。なぜボタンがクリック可能でないのか分かりません。 – James
コードが追加されたボタンをクリックするとスライドショー表示になりますか?アクション設定/ハイパーリンクなどは、スライドショーの表示でのみ機能し、標準またはその他の表示では機能しません。 –