ContainerHTMLTag_ReturnBlock

Returns the full string starting from open tag of container where LocationIndex is found, until the close tag
Like a, img, div, table, tr, td, etc.
Needs the LocationIndex that will be searched in inHTMLBlock

CodeFunctionName
What is this?

Public

Tested

Original Work
Function ContainerHTMLTag_ReturnBlock(LocationIndex, inHTMLBlock)
    ' Returns the full string starting from open tag of container where LocationIndex is found, until the close tag
    ' Like a, img, div, table, tr, td, etc.
    ' Needs the LocationIndex that will be searched in inHTMLBlock
    '
    Rett = ""
    If LocationIndex > Len(inHTMLBlock) Then GoTo ByeBye
    If LocationIndex < 0 Then GoTo ByeBye
    TagIgnore = 0
    For I = LocationIndex To 1 Step -1
        If Mid(inHTMLBlock, I, 1) = " <" And Mid(inHTMLBlock, I, 2) < > " </" And TagIgnore < 1 Then
            NextSpace = VBInstr(" ", inHTMLBlock, I)
            If NextSpace = 0 Then GoTo ByeBye
           
            ' I now has location of container open tag
            TagOpen = Mid(inHTMLBlock, I + 1, NextSpace - I - 1)
            For J = LocationIndex To Len(inHTMLBlock)
                If Mid(inHTMLBlock, J, Len(TagOpen) + 3) = " </" & TagOpen & " >" Then
                   
                    Rett = CutString1(inHTMLBlock, I, J + Len(TagOpen) + 3)
                    Exit For
                End If
            Next
'            Rett = Mid(inHTMLBlock, I + 1, NextSpace - I - 1)
            Exit For
        ElseIf Mid(inHTMLBlock, I, 1) = " <" And Mid(inHTMLBlock, I, 2) < > " </" And TagIgnore > 0 Then
            TagIgnore = TagIgnore - 1
        ElseIf Mid(inHTMLBlock, I, 2) = " </" Then
            ' Ignore open tag for this closed one
            TagIgnore = TagIgnore + 1
        End If
       
    Next
ByeBye:
    ContainerHTMLTag_ReturnBlock = Rett
End Function

LocationIndex, inHTMLBlock

Views 481

Downloads 23

CodeID
DB ID