請參閱以下內容:
Sub Test()
Dim IE As Object
Dim reg As New RegExp
reg.Pattern = "\$\d+.?\d?\d?"
Sheets("Sheet3").Select
Range("A1:A1000") = "" ' erase previous data
Range("A1").Select
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
'IE.Navigate "https://www.google.com/" ' should work for any URL
IE.Navigate "https://www.google.com/?_rd=ssl#q=" & "DNR-12-1-G Price"
Do While IE.Busy = True Or IE.readyState <> 4: DoEvents: Loop
'IE.Document.getElementById("lst-ib").Value = "DNR-12 Price"
'Do While IE.Busy = True Or IE.readyState <> 4: DoEvents: Loop
'SendKeys ("{ENTER}")
IE.ExecWB 17, 0 '// SelectAll
IE.ExecWB 12, 2 '// Copy selection
ActiveSheet.PasteSpecial Format:="Text", link:=False, DisplayAsIcon:=False
Range("A1").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.Delete Shift:=xlUp
'MsgBox (Continue)
IE.Quit
End Sub
來源
2016-08-02 23:14:53
Bob
你嘗試過什麼到目前爲止?你能發佈代碼嗎? –