Hello, I'm trying to get this search function to have a quit option, i.e. stop/cancel when clicked on no. The search and search next is working perfectly, but as soon as I add the the if response for the message box, it's not working. Thanks!!!
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)Dim strToFind As String
Dim osld As Slide
Dim oshp As Shape
Dim MsgBoxResult As Long
If KeyCode = 13 Then 'ENTER PRESSED
strToFind = UCase(Me.TextBox1.Text)
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), strToFind) > 0 Then
SlideShowWindows(1).View.GotoSlide (osld.SlideIndex)
MsgBox "On this slide", vbYesNo + vbQuestion, "Search Function"
If response = vbNo Then
Exit Sub
ElseIf response = vbYes Then
Exit For
End If
End If
End If
Next oshp
Next osld
MsgBox "Finished"
Me.TextBox1.Text = ""
End If
End Sub