首页 /编程语言和算法/VB6/VBA/ASP
 VBA代码 网页过滤得到想要的内容 HtmlFilter
2025年3月18日 14:57
Public Function HtmlFilter(htmlText, Label1, label2)
    '返回html字符串lable1和最近的lable2标签中的数据
    Dim pStart As Long, pStop As Long
    '开始位置,结束位置
    pStart = InStr(htmlText, Label1) + Len(Label1)
    '找到标签信息的起始位置
    If pStart > Len(Label1) Then
        pStop = InStr(pStart, htmlText, label2)

        If pStop - pStart <= 0 Then
            HtmlFilter = ""
        Else
            HtmlFilter = Mid(htmlText, pStart, pStop - pStart)
        End If
    End If
End Function



 
全部回复(0)
首页 | 电脑版 |