簡體   English   中英

PowerPoint VBA - 在幻燈片模式下打開幻燈片時自動運行幻燈片中的按鈕

[英]PowerPoint VBA - Auto Run a button in slide when opening slide in SlideShow mode

我在特定幻燈片(示例幻燈片編號 10)中創建了一個按鈕,如下所示:

Private Sub CommandButton1_Click()
Label1_Click
End Sub

當我在幻燈片模式下打開這張幻燈片時,我想自動運行這個按鈕。 哪個命令可以調用這個私有按鈕?

在我創建的模塊中

Sub OnSlideShowPageChange()
    Dim i As Long
    i = ActivePresentation.SlideShowWindow.View.CurrentShowPosition
    Select Case i
        Case 10
            ==> which command can call a specific button action included in a specific slide?
            
        Case 11
            xxxxx
        Case 12
            xxxx
    End Select
    
End Sub

看來你把事情復雜化了。 與其嘗試自動單擊調用代碼的按鈕,不如直接調用代碼。

Sub OnSlideShowPageChange()
    Dim i As Long
    i = ActivePresentation.SlideShowWindow.View.CurrentShowPosition
    Select Case i
        Case 10
            ==> which command can call a specific button action included in a specific slide?
' just call the code:
MsgBox "Call the code directly rather that trying to activate a button"
            
        Case 11
            xxxxx
        Case 12
            xxxx
    End Select
    
End Sub

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM