Link to home
Start Free TrialLog in
Avatar of Kanwaljit Singh Dhunna
Kanwaljit Singh DhunnaFlag for India

asked on

Print the page only if a certain word is found on web page

Hi Experts I am using the following code to print data fetched from web search to printer.
Lot of hits are done using pre-defined values. But I need to print only the successful hit only. So the following code needs to be amended to PRINT ONLY IF the page contains the words "Assessment Year". If the word is found then it should print and give a sound. But if the value is not found then it should keep searching till the list is exhausted.

Sub SavePageHTML(doc, strPath, strFileName)
Dim strHTML As String
Dim FF As Long

    If Dir(strPath & "\" & strFileName) = "" Then

        FF = FreeFile()

        strHTML = doc.body.innerhtml

        Open strPath & "\" & strFileName For Output As #FF

        Print #FF, "<link href=""../challan.css"" rel=""stylesheet"" type=""text/css"" />"
        Print #FF, strHTML

        Close #FF

    Else
    
        FF = FreeFile()
        
        strHTML = doc.body.innerhtml

        Open strPath & "\" & strFileName For Append As #FF

        Print #FF, strHTML

        Close #FF
    End If

End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Dany Balian
Dany Balian
Flag of Lebanon image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.