ContainerHTMLTag

Returns HTML tag of the container of certain location inside HTML block.
Provide the LocationIndex and HTML block.
Cannot smartly detect if there is single or double quotation enclosing the tag symbol yet.

CodeFunctionName
What is this?

Public

Tested

Original Work
Function ContainerHTMLTag(LocationIndex, inHTMLBlock)
    ' Returns the tag of the container, without < or >
    ' 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
    For I = LocationIndex To 0 Step -1
        If Mid(inHTMLBlock, I, 1) = " <" Then
            NextSpace = VBInstr(" ", inHTMLBlock, I)
            If NextSpace = 0 Then GoTo ByeBye
            Rett = Mid(inHTMLBlock, I + 1, NextSpace - I - 1)
            Exit For
        End If
    Next
ByeBye:
    ContainerHTMLTag = Rett
End Function

LocationIndex, inHTMLBlock

Views 280

Downloads 69

CodeID
DB ID