ANmaHTMLContent

Reads certain part in HTML output of a page.
Will search for list of strings in a page, then returns the result to caller.
List of strings to search should be passed during call. URL to page (or the actual output of that page) also needed.
Please read notes inside function.

Was looking to create this function for almost a year now, did get the chance lately in one of my projects.

CodeFunctionName
What is this?

Public

Tested

Original Work
Function ANmaHTMLContent(Optional FromURL = "", Optional Or_FullPage = "", Optional FullListCond = "SearchFor{|}Then For{|}Then find between me{~} and me")
    ' Reads certain string from a webpage using full condition string list, please read ...
    ' Needs Navigate() only if or_FullePage is not passed
    ' FromURL: URL for the page
    ' or_FullPage: or if FromURL is not passed, need to past the full page html
    ' FullListCond: List of strings separated by {|} to search for inside the page, then final item should have character {~} to identify what to read from ...
    '            Example: Consolidated Statement of Income </span >{|}Net sales </span >{|} <td {|} <span {|} <ix:{|} >{~} </ix:
    '            Tool will search for ... Consolidated Statement of Income </span >
    '                in page
    '            Then for ... Net sales </span >
    '            Then for ... <td
    '            Then for ... <span
    '            Then for ... <ix:
    '            Then returns what between > and </ix:
    ' Originally from WWR!CI.xlsb!Edgar_ReadValue_Type2(Page6, FullCond)
    Rett = ""
    Page6 = Or_FullPage
    If FromURL > "" Then
        Page6 = Navigate(Cstr(FromURL), "")
    End If
    If Page6 = "" Then goto ByeBye
    Crowler = 0
    For Each Con1 In Split(FullCond, "{|}")
        If Con1 = "" Then GoTo NextCon1
        If VBInstr("{~}", Con1) > 0 Then
            Crowler = VBInstr(CutString3(Con1, 1, "{~}"), Page6, Crowler + 1)
            CrLen = VBInstr(CutString3(Con1, 2, "{~}"), Page6, Crowler + 1) - Crowler
            Rett = Mid(Page6, Crowler + 1, CrLen - 1)
            Exit For
        Else
            Crowler = VBInstr(Con1, Page6, Crowler + 1)
        End If
NextCon1:
    Next
ByeBye:
    ANmaHTMLContent = Rett
End Function

Optional FromURL = "", Optional Or_FullPage = "", Optional FullListCond = "SearchFor{|}Then For{|}Then find between me{~} and me"

Example: Consolidated Statement of Income</span>{|}Net sales</span>{|}<td {|}<span {|}<ix:{|}>{~}</ix:
Tool will search for ... Consolidated Statement of Income</span> in page
Then for ... Net sales</span>
Then for ... <td
Then for ... <span
Then for ... <ix:
Then returns what between > and </ix:

Views 138

Downloads 48

CodeID
DB ID