Top  Previous  Next

function FindHtmlTag(sPageSource, sTagName, sParamName, ByRef iStartPos, ByRef iLength) As Boolean


Searches in sPageSource for the first occurrence of the HTML tag sTagName that contains the parameter sParamName.


FindHtmlTag is case-insensitive. The first character in sPageSource has the position 1. If sTagName and sParamName are found, FindHtmlTag returns TRUE.




sPageSource ... String expression sought.
sTagName, sParamName ... String expressions. HTML tag with parameter being searched.
iStartPos ... Index of tag start.
iLength ... Length of found tag.



Dim s, iStart, iLen


= "Click <a href=info.htm>here</a> for more information"

If FindHtmlTag(s, "a", "HREF", iStart, iLen) Then

   ' returns iStart = 7, iLen = 17


   s = Mid(s, iStart, iLen)

   ' returns s = "<a href=info.htm>"

End If