Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PowerPoint VBA-在幻灯片放映模式下打开幻灯片时自动运行幻灯片中的按钮_Vba_Powerpoint - Fatal编程技术网

PowerPoint VBA-在幻灯片放映模式下打开幻灯片时自动运行幻灯片中的按钮

PowerPoint VBA-在幻灯片放映模式下打开幻灯片时自动运行幻灯片中的按钮,vba,powerpoint,Vba,Powerpoint,我在特定幻灯片(示例幻灯片编号10)中创建了一个按钮,如下所示: Private Sub CommandButton1_Click() Label1_Click End Sub 我想在幻灯片放映模式下打开此幻灯片时自动运行此按钮。 哪个命令可以调用此专用按钮 在我创建的模块中 Sub OnSlideShowPageChange() Dim i As Long i = ActivePresentation.SlideShowWindow.View.CurrentShowPosit

我在特定幻灯片(示例幻灯片编号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

看来你把事情复杂化了。与其尝试自动单击调用代码的按钮,不如直接调用代码

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

您希望自动运行宏,而不是按钮。PowerPoint中的任何自动操作都需要使用事件。下面是对事件的介绍:如何设置事件侦听器:不同版本支持的事件列表:您希望自动运行宏,而不是按钮。PowerPoint中的任何自动操作都需要使用事件。以下是事件简介:如何设置事件侦听器:不同版本支持的事件列表: