请放心,因为我是新来的。我创建了几个宏,它们从以下内容中提取搜索结果:全文搜索:http://searchwww.sec.gov/EDGARFSClient/jsp/EDGAR_MainAccess.jsp
现在我的数据全部清理完毕并设置在不同的列中,我需要根据结果创建一个查询。在B列中,我有一个公司名称的列表,我想引用“ B”列中的每个单元格,并在http://www.marketwatch.com/tools/quotes/lookup.asp?siteID=mktw&Lookup=options+media&Country=us&Type=All的市场观察中查询与公司名称相关的股票代码。这将对我有所帮助,因为最终我将要执行多个查询,以获取有关股权结构,收入等方面的信息。随时回答这个问题,我将不胜感激。
尝试下面的代码。
Sub website()
Dim doc As HTMLDocument
Dim htmTable As HTMLTable
Set doc = New HTMLDocument
With CreateObject("MSXML2.XMLHTTP")
.Open "GET", "http://www.marketwatch.com/investing/stock/BAC"
.send
Do: DoEvents: Loop Until .readyState = 4
doc.body.innerHTML = .responseText
.abort
End With
Set htmTable = doc.getElementsByClassName("companyname")(0)
If Not htmTable Is Nothing Then
MsgBox htmTable.innerText
End If
Set htmTable = doc.getElementsByClassName("lastprice")(0)
If Not htmTable Is Nothing Then
MsgBox htmTable.innerText
End If
End Sub