PowerPoint VBA TextBox KeyDown Callback
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
' https://tdalon.blogspot.com/2016/09/powerpoint-quick-search-tagged-slides.html
' References: http://stackoverflow.com/questions/26587114/powerpoint-search-box-vba
' Hidden Search TextBox
Dim osld As Slide
Dim oshp As Shape
Dim sTextToFind As String
If KeyCode <> 13 Then 'ENTER PRESSED
Exit Sub
End If
sTextToFind = Me.TextBox1.Text
If Left(sTextToFind, 1) = "#" Then ' Only look for tagged shapes if search for tag
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If (oshp.Tags("HideMe") = "YES") And oshp.HasTextFrame Then
If oshp.TextFrame.HasText Then
If InStr(UCase(oshp.TextFrame.TextRange), UCase(sTextToFind)) > 0 Then
SlideShowWindows(1).View.GotoSlide (osld.SlideIndex)
Exit Sub
End If
End If
End If
Next oshp
Next osld
Else
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If oshp.HasTextFrame Then
If oshp.TextFrame.HasText Then
If InStr(UCase(oshp.TextFrame.TextRange), UCase(sTextToFind)) > 0 Then
SlideShowWindows(1).View.GotoSlide (osld.SlideIndex)
Exit Sub
End If
End If
End If
Next oshp
Next osld
End If
MsgBox "Not found"
End Sub