Я пишу макрос, чтобы определить, отсутствуют ли текстовые строки в форме PowerPoint в диапазоне Excel.
Идея в последнем цикле состоит в том, что если текстовая строка в форме не найдена в диапазоне Excel, она записывается. Он не работает, так как код возвращает все строки в форме, что означает, что ни одна из них не была найдена, и если я добавлю условие Not он не вернет никаких строк, даже тех, которые не находятся в диапазоне Excel.
Есть идеи?
Вот мой код:
Sub Updt_OrgChart_Test1()
Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
Set PPApp = CreateObject("Powerpoint.Application")
PPApp.Visible = True
Set PPPres = PPApp.Presentations("presentation 2016.pptx")
Set PPSlide = PPPres.Slides(6)
Dim wb As Workbook
Dim teste_ws As Worksheet
Dim SDA_ws As Worksheet
Set wb = ThisWorkbook
Set teste_ws = wb.Sheets("Teste")
Set SDA_ws = wb.Sheets("FZ SW KRK SDA")
Dim shp As PowerPoint.Shape
Dim L5AndTeam As String
L5AndTeam = SDA_ws.Range("C3")
Dim Employee_Rng As Range
Set Employee_Rng = SDA_ws.Range(Range("B8"), Range("B8").End(xlDown))
For Each shp In PPSlide.Shapes
     On Error Resume Next
     If shp.TextFrame.HasText Then
       If shp.TextFrame.TextRange.Lines.Count > 2 Then
         If Left(shp.Name, 3) = "Rec" Then
            Dim prg As PowerPoint.TextRange
            For Each prg In shp.TextFrame.TextRange.Paragraphs
                Dim nm As String
                nm = prg
                If Employee_Rng.Find(nm.Value) Is Nothing Then
                   MsgBox nm  <---- this is just a test, will add more code here
                End If
            Next prg
           End If
        End If
     End If
Next shp
End Sub
 