View Single Post
 
Old 02-18-2021, 07:10 AM
JohnWilson JohnWilson is offline Windows 10 Office 2016
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,914
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

This should at least give you a start. Make sure you keep a copy of the original!! Obviously change the path to the text file.

Code:
Sub Read_Txt_and_Check()

Dim fileNum As Integer
Dim RayTxt() As String
Dim L As Long
Dim T As Long
Dim b_Found As Boolean

fileNum = FreeFile
Open "C:\Users\info\Desktop\text.txt" For Input As fileNum
ReDim RayTxt(0)
Do While Not EOF(fileNum)
    ReDim Preserve RayTxt(UBound(RayTxt) + 1)
    Line Input #fileNum, RayTxt(UBound(RayTxt))
Loop
Close #fileNum

For L = ActivePresentation.Slides.Count To 1 Step -1
b_Found = False
For T = LBound(RayTxt) To UBound(RayTxt)
If word_Found(RayTxt(T), ActivePresentation.Slides(L).NotesPage.Shapes(2).TextFrame.TextRange) Then
b_Found = True
Exit For
End If
Next T
If b_Found Then ActivePresentation.Slides(L).Delete
Next L
End Sub

Function word_Found(strword As String, otxtR As TextRange) As Boolean
On Error Resume Next
Dim found As TextRange
Set found = otxtR.Find(FindWhat:=strword, MatchCase:=False, Wholewords:=True)
If Not found Is Nothing Then word_Found = True
End Function
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote