• VBA操作IE


    1.参照项目
      Microsoft Internet Controls
      Microsoft HTML Object
     
    2.sample
    Sub GetIEItem()


    Dim objIE As InternetExplorer

    Set objIE = CreateObject("Internetexplorer.Application")

    objIE.Visible = True

    Dim url As String

    url = "https://www.baidu.com/"

    objIE.Navigate url, "JDK1.8"

    Application.Wait Now() + TimeValue("00:00:03")

    Dim htmlDoc As HTMLDocument

    Set htmlDoc = objIE.Document

    htmlDoc.getElementById("kw").value = "JDK1.8"

    htmlDoc.getElementById("su").Click

    Application.Wait Now() + TimeValue("00:00:03")


    ' Dim element As IHTMLElement
    '
    ' For Each element In htmlDoc.getElementsByTagName("h1")
    ' Debug.Print element.innerText
    ' Next element
    '
    ' Dim tr As HTMLTableRow
    ' For Each tr In htmlDoc.getElementsByTagName("tbody")(0).getElementsByTagName("tr")
    '
    ' Next tr

    End Sub
  • 相关阅读:
    多线程
    带缓存的字符输入输出流
    输入输出流(I/O)
    课本235页2-3题
    包装&工具类
    集合类SetMap
    tp框架之增删改查
    tp框架之数据添加
    tp框架之查询
    tp框架之Model类与命名空间
  • 原文地址:https://www.cnblogs.com/wzhw2015/p/12355037.html
Copyright © 2020-2023  润新知