Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-22-2015, 02:00 PM
JMer JMer is offline User form Help Windows 7 64bit User form Help Office 2010 64bit
Novice
User form Help
 
Join Date: Jul 2015
Posts: 6
JMer is on a distinguished road
Default User form Help

I have created a UserForm so that I can search my powerpoint slide during the presentation. I am trying to figure out how to code the command button "Next" on the userform to take me to the next time the searched word is found in the presentation. The code I am currently using is
Code:
Private Sub FCnext_Click()
If TextBox1 = True Then
  If Me.TextBox1.Text <> "" Then
    SlideShowWindows(1).View.GotoSlide (osld.SlideIndex)
  End If
End If
End Sub
 
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Dim osld As Slide
Dim oshp As Shape
Dim b_found As Boolean
If KeyCode = 13 Then 'ENTER PRESSED
  If Me.TextBox1.Text <> "" Then
    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(Me.TextBox1.Text)) > 0 Then
              SlideShowWindows(1).View.GotoSlide (osld.SlideIndex)
              Me.TextBox1.Text = ""
              b_found = True
              Exit For
            End If
          End If
        End If
      Next oshp
      If b_found = True Then Exit For
    Next osld
  End If
  If b_found = False Then MsgBox "Not found"
End If
End Sub
The second part is the search part for the text box inside of my user form, it works correctly, the trouble I am having is getting the command button to do the search again and take me to the next slide.

Thank you for any help.

Last edited by macropod; 07-22-2015 at 06:32 PM. Reason: Added code tags & formatting
Reply With Quote
 

Tags
userform, vba, vba powerpoint

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA to save word user form value to xml Rose roon Word VBA 25 06-23-2015 04:35 AM
User Form - Close Paragraphs SonyaEnz Word VBA 4 06-05-2015 06:16 AM
User form abdulgani Excel 0 12-15-2014 05:54 AM
User form Help User Form placasse47 Excel Programming 3 08-01-2012 05:57 AM
Controlling Style when a user pastes into a form Cris0205 Word 0 08-05-2010 04:33 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:44 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft