Tag: innertext

VBA“If … Then”在HTMLtag Innertext中find关键字

是否可以编写一个If … Then命令来引用HTML中的部分内联关键字/短语。 例如,我正在运行一个“If … Then”命令,该命令将使用包括短语“Records Found”在内的部分内联标签查找标签。 如果标签存在,则只有一个标签在其无限文字中包含这个短语。 如果这个标签存在,我想我的工作表中的一个单元格显示“find多个logging” Dim ErrLi As Object Dim ErrObj As Object Dim x As Integer Set ErrLi = IE.Document.GetElementById("DivCenterTopArea").GetElementsByTagName("li") If Not ErrLi Is Nothing Then For x = 1 To ErrLi.Length – 1 If ErrObj.innertext = & "records found." Then Range("Q" & (ActiveCell.Row)) = "Multiple Records Found" End If […]

无法获得特定的数据点从雅虎财务拉到Excel?

我试图从雅虎财经页面拉一个非常具体的数字,但我陷入困境。 我试图从中提取这个信息的链接是: http://finance.yahoo.com/q/hp?s=AAPL+Historical+Prices 我有兴趣获得在该页面顶部附近列出的111.31号码以粗体显示。 我已经写了下面的代码来提取这个信息,但是每次运行它,它都会说“对象不支持这个属性或方法”。 我怀疑错误在于我使用getElementsByClass和getElementsById来提取数据。 Sub GetQuote() Dim IE As Object Set IE = CreateObject("InternetExplorer.Application") With IE .Visible = True .navigate "http://finance.yahoo.com/q/hp?s=AAPL+Historical+Prices" Do While .busy: DoEvents: Loop Do While .ReadyState <> 4: DoEvents: Loop With .document Application.Wait (Now + #12:00:05 AM#) Sheets("Sheet1").Range("A3") = .getElementsByClass("time_rtq_ticker").getElementsById("yfs_184_aapl").innerText End With End With Set IE = Nothing End Sub […]

所选选项的VBA innertext为HTML下拉列表

有没有一种方法可以select网页下拉列表中所选选项的内联网? 我正在尝试这种方式,但不断收到错误对象要求: Dim drp As Object Set drp = IE.Document.getElementById("ctl05_Dropdownlist1").selectedindex Range("J" & (ActiveCell.Row)) = drp.innertext 我试图从HTML源代码的以下部分拉选定的选项innertext: <select name="ctl05$Dropdownlist1" id="ctl05_Dropdownlist1" disabled="disabled" class="input"> <option value=""></option> <option selected="selected" value="1">*DIRECT ISSUE</option> <option value="2">*DIWELD</option> <option value="3">*INACTIVE</option>

innertertext VBA和excel之间的冲突

我需要帮助从InternetExplorer抓取信息到Excel工作簿。 当我废品,innertext属性中的信息是正确的,但在excel中出现错误。 使用代码: Workbooks("Automatizar PSA").Sheets(1).Cells(linha, 5).Value = ie.Document.getelementsbyclassname("tr-visualizar-detalhes text-center")(i + 1).innertext 我认为这是因为他们承担了不同的variables,我使用variables检查,得到: Watch : : ie.Document.getelementsbyclassname("tr-visualizar-detalhes text-center")(i + 1).innertext : "06/04/2017 11:09 " : Variant/String : Módulo11.PSAScrap Watch : : Workbooks("Automatizar PSA").Sheets(1).Cells(linha, 5).Value : 04/06/2017 11:09:00 : Variant/Date : Módulo11.PSAScrap 任何帮助,我该如何解决? 对不起,我贴的方式,不熟悉论坛,我怎么能把它粘贴为代码? 谢谢!!