I am using MS Outlook to read a bunch of forums on SO. I have code that loop through items and checks for “[on hold]” or “[closed]” in the subject line. This works fine. I’m trying to modify the code a bit to do the following:
#1) look for language that reads "View article..." #2) click this link (need to get innerText) #3) scan the page that opens and check for language that reads "Page not found"
If this is true, I want to delete the current ‘myItem’ and move to the next ‘myItem’. I know my code below is close, but instead of ‘.navigate “https:’ etc., I need to get the innerText from the “View article…” hyperlink, click that, and scan the page that opens for the language “Page not found”. How can I do that?
Sub GetRssItem() Dim myNameSpace As Outlook.NameSpace Dim myFolder As Outlook.Folder Dim subFolder As Outlook.Folder Dim myItem As Object Dim IE As InternetExplorer Set myNameSpace = Application.GetNamespace("MAPI") Set myFolder = myNameSpace.GetDefaultFolder(olFolderRssFeeds) For i = 1 To 27 Set subFolder = myFolder.Folders(i) Debug.Print subFolder For Each myItem In subFolder.Items If InStr(myItem.Subject, "[on hold]") > 0 Or _ InStr(myItem.Subject, "[closed]") > 0 Then Debug.Print myItem.Subject myItem.Delete End If If myItem.Body Like "*" & "View article..." & "*" Then Set IE = New InternetExplorer With IE .Visible = True .navigate "https://stackoverflow.com/questions/57632973/delete-label-points-and-set-hover-text-and-legend-in-clustering-scatter-plot" 'CHANGE THIS While .Busy Or .readyState <> READYSTATE_COMPLETE DoEvents Wend Set HTMLdoc = .document If IE.Body Like "*" & "Page not found" & "*" Then myItem.Delete End If End With End If Next myItem Next i End Sub