Thread: User form Help
View Single Post
 
Old 07-23-2015, 02:28 AM
JohnWilson JohnWilson is offline Windows 7 64bit Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,913
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

Maybe this (you could easily add the keydown sub but it's not needed. Might need a little edit to get the all found correct.

Code:
Dim SldINX As Long
Private Sub UserForm_Initialize()
Me.FCnext.Caption = "Find"
End Sub
Private Sub FCnext_Click()
If SldINX = 0 Then SldINX = 1
Me.FCnext.Caption = "Next"
Call searchSlide(SldINX)
End Sub
Sub searchSlide(fromSld As Long)
Dim oshp As Shape
Dim osld As Slide
Dim Counter As Long
Dim b_found As Boolean
If SldINX > ActivePresentation.Slides.Count Then
MsgBox "Done"
Unload UserForm1
Exit Sub
End If
For Counter = fromSld To ActivePresentation.Slides.Count
Set osld = ActivePresentation.Slides(Counter)
For Each oshp In osld.Shapes
        If oshp.HasTextFrame Then
          If oshp.TextFrame.HasText Then
            If InStr(UCase(oshp.TextFrame.TextRange), UCase(Me.TextBox1.Text)) > 0 Then
              SlideShowWindows(1).View.GotoSlide (osld.SlideIndex)
              b_found = True
               SldINX = Counter + 1
               Exit For
            End If
          End If
        End If
      Next oshp
      If b_found Then Exit For
    Next Counter
  If b_found = False Then
  SlideShowWindows(1).View.GotoSlide (ActivePresentation.Slides.Count)
   MsgBox "Not Found"
  Me.TextBox1.Text = ""
  SldINX = 1
  Unload UserForm1
  End If
End Sub
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials

Last edited by JohnWilson; 07-23-2015 at 04:30 AM.
Reply With Quote