Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 07-22-2015, 02:24 PM
JMer JMer is offline UserForm VBA code Windows 7 64bit UserForm VBA code Office 2010 64bit
Novice
UserForm VBA code
 
Join Date: Jul 2015
Posts: 6
JMer is on a distinguished road
Default UserForm VBA code

I know this isnt the Powerpoint thread, but I need help with VBA code please.



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

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.
  #2  
Old 07-22-2015, 03:13 PM
macropod's Avatar
macropod macropod is offline UserForm VBA code Windows 7 64bit UserForm VBA code Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Please don't post the same question multiple times. And, when posting code, please also use the code tags, indicated by the # button on the posting menu, to maintain the code formatting. Thread closed.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Closed Thread



Similar Threads
Thread Thread Starter Forum Replies Last Post
UserForm VBA code Help with VBA userform benn PowerPoint 1 03-02-2015 11:32 AM
VBA Code in a UserForm module to delete a Command Button which opens the userform Simoninparis Word VBA 2 09-21-2014 03:50 AM
UserForm VBA code Is it possible to take an input from a UserForm in one document to a UserForm in a do BoringDavid Word VBA 5 05-09-2014 09:08 AM
Userform Code not quite right - help please vbanovice Word VBA 1 09-29-2013 09:20 PM
VBA code to update record in Access 2003 using Userform in Excel primmer3001 Excel Programming 0 08-29-2011 04:25 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:26 AM.


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