VBA:从HTML表中提取日期戳

时间:2017-06-19 14:19:23

标签: vba access-vba

我正在尝试在<td>6/19/2017 9:49:14 AM</td>中提取日期。 <td>Time extracted</td>始终位于同一行OddRow.getElementsByTagName("td")(*).innerText每次都会正常工作吗?

enter image description here

1 个答案:

答案 0 :(得分:0)

我认为这样的事情。

Sub Scrape_HTML()

Set ie = CreateObject("InternetExplorer.application")

With ie
    .Visible = True
    .navigate "your_URL_here"

' Wait for the page to fully load; you can't do anything if the page is not fully loaded
Do While .Busy Or _
    .readyState <> 4
    DoEvents
Loop

                        Set Links = ie.document.getElementsByTagName("td")
                        RowCount = 1

                            ' Scrape out the innertext of each 'td' element.
                            With Sheets("DataSheet")
                                For Each lnk In Links
                                    .Range("A" & RowCount) = lnk.innerText
                                    RowCount = RowCount + 1
                                Next
                            End With

End Sub