我一直试图从 IMDB 获取信息到 Excel 表,到目前为止,我在 excel 中找到了下面的 vba 代码。
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Row = Range("A2").Row And _
Target.Column = Range("A2").Column Then
Dim IE As New InternetExplorer
'IE.Visible = True
IE.Navigate "http://www.imdb.com/title/tt" & Range("A2").Value
Do
DoEvents
Loop Until IE.readyState = READYSTATE_COMPLETE
Dim Doc As HTMLDocument
Set Doc = IE.document
Dim sDD As String
sDD = Trim(Doc.getElementsByTagName("h1")(0).innerText)
IE.Quit
Dim aDD As Variant
aDD = Split(sDD)
Range("B2").Value = aDD(0)
End If
End Sub
现在我想要Range("A2")
多个单元格或任何其他代码。