Home > Software engineering >  Use VBA scraping of the page data
Use VBA scraping of the page data

Time:10-06

I want to use VBA to grab the data above, http://www.cninfo.com.cn/information/companyinfo.html
Want to grab investor relations information - & gt; Research activities under the date of in every news headlines and news release date

CodePudding user response:

Top of the ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

CodePudding user response:

http://club.excelhome.net/thread-893760-1-1.html

CodePudding user response:

refer to the second floor caozhy response:
http://club.excelhome.net/thread-893760-1-1.html

Moderators, greatly to be done according to the tutorial I try, but can't post submitted to go up and don't know how to do ah, beginners don't understand ah,,,
 
Sub test ()
Dim strRespText $, $, tt i& DW $
Dim URL
URL="http://www.cninfo.com.cn/information/companyinfo.html"
With CreateObject (" Microsoft. XMLHTTP ")
. Open the "GET", URL, False
. Send
Tt.=the responseText
With CreateObject (" new: {1 c3b4210 F441-11 ce - B9EA - 00 aa006b1a69} ")
The SetText tt
. PutInClipboard
End With
'tt=BytesToBstr (ResponseBody, "GB2312")
'tt=StrConv (ResponseBody, vbUnicode, & amp; H804)
Tt=StrConv (ResponseBody, vbUnicode)
With CreateObject (" new: {1 c3b4210 F441-11 ce - B9EA - 00 aa006b1a69} ")
The SetText tt
. PutInClipboard
End With

End With

View state=Split (Split (tt, "hlmname" value="" "") (1), "" "") (0)
Eventvalidation=Split (Split (tt, "hstockcode" value="" "") (1), "" "") (0)
'MsgBox (view state)
Dim Leibie
Leibie="TZZGXXX"
Dim code
Code="000001"

With CreateObject (" WinHttp WinHttpRequest. 5.1 ")
Tt=""
. Open the "POST", URL, False
. SetRequestHeader "Referer", URL
The content-type. SetRequestHeader ", "" application/x - WWW - form - urlencoded; Charset=utf-8 "
. SetRequestHeader "Connection", "Keep Alive -
". Send "hlmname=" & amp; Leibie & amp; "& amp; Hstockcode="& amp; Code
Tt.=the responseText
With CreateObject (" new: {1 c3b4210 F441-11 ce - B9EA - 00 aa006b1a69} ")
The SetText tt
. PutInClipboard
End With
End With
View state=Split (Split (tt, "hlmname" value="" "") (1), "" "") (0)
Eventvalidation=Split (Split (tt, "hstockcode" value="" "") (1), "" "") (0)
MsgBox (view state)

End Sub

CodePudding user response:

reference xiaoyao961 reply: 3/f
collection tools we can do,
m with VBA scraping of the page dataQq527524938

Can you help me take a look at this code?
 Sub test () 
Dim strRespText $, $, tt i& DW $
Dim URL
URL="http://www.cninfo.com.cn/information/companyinfo.html"
With CreateObject (" Microsoft. XMLHTTP ")
. Open the "GET", URL, False
. Send
Tt.=the responseText
With CreateObject (" new: {1 c3b4210 F441-11 ce - B9EA - 00 aa006b1a69} ")
The SetText tt
. PutInClipboard
End With
'tt=BytesToBstr (ResponseBody, "GB2312")
'tt=StrConv (ResponseBody, vbUnicode, & amp; H804)
Tt=StrConv (ResponseBody, vbUnicode)
With CreateObject (" new: {1 c3b4210 F441-11 ce - B9EA - 00 aa006b1a69} ")
The SetText tt
. PutInClipboard
End With

End With

View state=Split (Split (tt, "hlmname" value="" "") (1), "" "") (0)
Eventvalidation=Split (Split (tt, "hstockcode" value="" "") (1), "" "") (0)
'MsgBox (view state)
Dim Leibie
Leibie="TZZGXXX"
Dim code
Code="000001"

With CreateObject (" WinHttp WinHttpRequest. 5.1 ")
Tt=""
. Open the "POST", URL, False
. SetRequestHeader "Referer", URL
The content-type. SetRequestHeader ", "" application/x - WWW - form - urlencoded; Charset=utf-8 "
. SetRequestHeader "Connection", "Keep Alive -
". Send "hlmname=" & amp; Leibie & amp; "& amp; Hstockcode="& amp; Code
Tt.=the responseText
With CreateObject (" new: {1 c3b4210 F441-11 ce - B9EA - 00 aa006b1a69} ")
The SetText tt
. PutInClipboard
End With
End With
View state=Split (Split (tt, "hlmname" value="" "") (1), "" "") (0)
Eventvalidation=Split (Split (tt, "hstockcode" value="" "") (1), "" "") (0)
MsgBox (view state)

End Sub
  • Related