查看: 27  |  回复: 0
  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


您需要登录后才可以回帖 登录 | 立即注册
【本版规则】请勿发表违反国家法律的内容,否则会被冻结账号和删贴。
用户名: 立即注册
密码:
2020-2025 MaNongKu.com