如何在PowerPoint中创建Search.vba脚本以浏览文件夹中的文件并给我幻灯片?

我有此代码可以在PowerPoint文件中搜索,但不能正常工作,但这不是唯一的问题,我需要的是我的PowerPoint文件中包含一个 Form 一个搜索引擎,当我在文本框中输入ID时,它将打开“文件夹”中包含该ID的所有PowerPoint文件。

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
Dim oTxtRng As textrange
Dim sTextToFind As String

sTextToFind = Me.TextBox1.Text


 If KeyCode = 13 Then 
     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)
                             Set oTxtRng = oshp.TextFrame.textrange.Characters(InStr(oshp.TextFrame.textrange.Text,sTextToFind),Len(sTextToFind))
                             Debug.Print oTxtRng.Text

                             With oTxtRng
                                 .Font.Bold = True
                             End With

                             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

此行出现错误: SlideShowWindows(1).View.GotoSlide(osld.SlideIndex)

dingweiqiang 回答:如何在PowerPoint中创建Search.vba脚本以浏览文件夹中的文件并给我幻灯片?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3124873.html

大家都在问