Thread: User form Help
View Single Post
 
Old 07-24-2015, 05:41 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

This is straight off the top of my head but it might work

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
Dim oTxtTemp As TextRange
Dim strFind As String
On Error Resume Next
For Each osld In ActivePresentation.Slides
osld.Shapes("redBox").Delete
Next osld
If SldINX > ActivePresentation.Slides.Count Then
MsgBox "Done"
Unload UserForm1
Exit Sub
End If
strFind = Me.TextBox1.Text
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
            Set oTxtTemp = oshp.TextFrame.TextRange.Find(strFind, , False)
            If Not oTxtTemp Is Nothing Then
              SlideShowWindows(1).View.GotoSlide (osld.SlideIndex)
              With osld.Shapes.AddShape(msoShapeRectangle, oTxtTemp.BoundLeft, oTxtTemp.BoundTop, oTxtTemp.BoundWidth, oTxtTemp.BoundHeight)
              .Fill.Visible = False
              .Line.ForeColor.RGB = vbRed
              .Name = "redBox"
              End With
              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
Reply With Quote