物件名稱包含變數 + 應用紀錄

Dim s1, s2 As Integer
Sub OnSlideShowPageChange()
    s1 = 1
    s2 = 1
    With ActivePresentation.Slides(SlideShowWindows(1).View.Slide.SlideIndex)
        If .Shapes.Title.TextFrame.TextRange.Text = "Windows 安裝Splunk" Then
            allhide
            selectphoto (s1)
        ElseIf .Shapes.Title.TextFrame.TextRange.Text = "Windows 設定 Forward" Then
            allhide_1
            selectphoto_1 (s2)
        End If
    End With
End Sub
Function allhide()
    With ActivePresentation.Slides(SlideShowWindows(1).View.Slide.SlideIndex)
        If .Shapes.Title.TextFrame.TextRange.Text = "Windows 安裝Splunk" Then
            For i = 1 To 24 Step 1
                .Shapes("windows_splunk_" & Format(i, "00")).Visible = msoFalse
                'format設定2位數,不足2位數補0
            Next i
        End If
    End With
End Function
Function selectphoto(num As Integer)
    With ActivePresentation.Slides(SlideShowWindows(1).View.Slide.SlideIndex)
        If .Shapes.Title.TextFrame.TextRange.Text = "Windows 安裝Splunk" Then
            .Shapes("windows_splunk_" & Format(num, "00")).Visible = msoTrue
            .Shapes("windows_splunk_" & Format(num, "00")).ZOrder msoBringToFront
        End If
    End With
End Function
Sub photo_back()
    With ActivePresentation.Slides(SlideShowWindows(1).View.Slide.SlideIndex)
        If .Shapes.Title.TextFrame.TextRange.Text = "Windows 安裝Splunk" Then
            s1 = s1 - 1
            If s1 = 0 Then s1 = 24
            allhide
            selectphoto (s1)
        End If
    End With
End Sub
Sub photo_next()
    With ActivePresentation.Slides(SlideShowWindows(1).View.Slide.SlideIndex)
        If .Shapes.Title.TextFrame.TextRange.Text = "Windows 安裝Splunk" Then
            s1 = s1 + 1
            If s1 = 25 Then s1 = 1
            allhide
            selectphoto (s1)
        End If
    End With
End Sub
Function allhide_1()
    With ActivePresentation.Slides(SlideShowWindows(1).View.Slide.SlideIndex)
        If .Shapes.Title.TextFrame.TextRange.Text = "Windows 設定 Forward" Then
            For i = 1 To 6 Step 1
                .Shapes("windows_forward_" & Format(i, "00")).Visible = msoFalse
            Next i
        End If
    End With
End Function
Function selectphoto_1(num As Integer)
    With ActivePresentation.Slides(SlideShowWindows(1).View.Slide.SlideIndex)
        If .Shapes.Title.TextFrame.TextRange.Text = "Windows 設定 Forward" Then
            .Shapes("windows_forward_" & Format(num, "00")).Visible = msoTrue
            .Shapes("windows_forward_" & Format(num, "00")).ZOrder msoBringToFront
        End If
    End With
End Function
Sub photo_back_1()
    With ActivePresentation.Slides(SlideShowWindows(1).View.Slide.SlideIndex)
        If .Shapes.Title.TextFrame.TextRange.Text = "Windows 設定 Forward" Then
            s2 = s2 - 1
            If s2 = 0 Then s2 = 6
            allhide_1
            selectphoto_1 (s2)
        End If
    End With
End Sub
Sub photo_next_1()
    With ActivePresentation.Slides(SlideShowWindows(1).View.Slide.SlideIndex)
        If .Shapes.Title.TextFrame.TextRange.Text = "Windows 設定 Forward" Then
            s2 = s2 + 1
            If s2 = 6 Then s2 = 1
            allhide_1
            selectphoto_1 (s2)
        End If
    End With
End Sub
This entry was posted in PowerPoint. Bookmark the permalink.