#1
|
|||
|
|||
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
|
||||
|
||||
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] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
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 |
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 |