ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ½Ð±Ðºô­¶®»¨úªº°ÝÃD¡H CreateObject("msxml2.xmlhttp") ªº°ÝÃD?

[µo°Ý] ½Ð±Ðºô­¶®»¨úªº°ÝÃD¡H CreateObject("msxml2.xmlhttp") ªº°ÝÃD?

½Ð±Ðºô­¶®»¨úªº°ÝÃD¡H CreateObject("msxml2.xmlhttp") ªº°ÝÃD?
  1. Sub test() '¨ú·l¯qªí(¦~ªí)ºô­¶
  2. Dim Url, HTMLsourcecode, GetXml, TableG, i, j
  3. Set HTMLsourcecode = CreateObject("htmlfile")
  4. Set GetXml = CreateObject("msxml2.xmlhttp")
  5. Url = "http://kgieworld.moneydj.com/z/zc/zcq/zcqa/zcqa_2330.djhtm"
  6. With GetXml
  7. .Open "GET", Url, False
  8. .send

  9. ' Debug.Print .document.all(0).getElementsByTagName("div")(0).outerHTML
  10.   ' Debug.Print .document.all(0).getElementsByClassName("t11")(0).outerHTML
  11. ' Debug.Print .document.all(0).getElementsByClassName("table-row")(11).outerHTML
  12. '  Debug.Print .document.all(0).getElementsByClassName("t4t1 table-cell")(2).outerHTML
  13.   'Debug.Print .document.all(0).getElementsByClassName("t3n1 table-cell")(0).outerHTML
  14.   'Debug.Print .document.all(0).getElementsByClassName("t3n1 table-cell")(482).outerHTML
  15.   Debug.Print .document.all(0).getElementsByClassName("t3n1 table-cell")(482).innerHTML

  16. Debug.Print "test"
  17. End With
  18. Set HTMLsourcecode = Nothing 'ÄÀ©ñ°O¾ÐÅé
  19. Set GetXml = Nothing
  20. End Sub '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
½Æ»s¥N½X
½Ð±Ð¤j¤j¡Aºô­¶§ïª©¡A¸Õ­×§ïµ{¦¡¡ADebug.Print .document.all(0).getElementsByClassName("t3n1 table-cell")(482).innerHTML
¥ÎCreateObject("InternetExplorer.Application")¥i°õ¦æ¡A¥ÎCreateObject("msxml2.xmlhttp") ·|¿ù»~¡A½Ð°Ý¦p¦ó­×§ï¡AÁÂÁÂ

§Ú¸ÕµÛ¤@­Ó¤èªk®»ªí®æ¦³§ó¦nªº¤èªk³Â·Ð¤j¤j§iª¾
Sub Test() '¨ú·l¯qªí(¦~ªí)ºô­¶
Dim Url, HTMLsourcecode, GetXml, TableG, i, j
Set HTMLsourcecode = CreateObject("htmlfile")
Set GetXml = CreateObject("msxml2.xmlhttp")
Url = "http://kgieworld.moneydj.com/z/zc/zcq/zcqa/zcqa_2330.djhtm"
With GetXml
.Open "GET", Url, False
.Send

HTMLsourcecode.body.innerhtml = .Responsetext

' Debug.Print HTMLsourcecode.all.tags("div")(12).innertext
' Debug.Print HTMLsourcecode.all.tags("div")(15).innertext
' Debug.Print HTMLsourcecode.all.tags("span")(15).innertext
' Debug.Print HTMLsourcecode.all.tags("span")(400).innertext
' Debug.Print HTMLsourcecode.all.tags("span")(482).innertext

'For i = 5 To 10
'  Debug.Print HTMLsourcecode.all.tags("div")(i).innertext
' Next i


For j = 0 To 300
  Debug.Print HTMLsourcecode.all.tags("span")(j).innertext
Next j
'
' Debug.Print HTMLsourcecode.all.tags("div")(5).innertext
' Debug.Print HTMLsourcecode.all.tags("div")(6).innertext
' Debug.Print HTMLsourcecode.all.tags("span")(0).innertext
' Debug.Print HTMLsourcecode.all.tags("span")(1).innertext
' Debug.Print HTMLsourcecode.all.tags("span")(2).innertext
' Debug.Print HTMLsourcecode.all.tags("span")(3).innertext
' Debug.Print HTMLsourcecode.all.tags("span")(4).innertext
' Debug.Print HTMLsourcecode.all.tags("span")(5).innertext
' Debug.Print HTMLsourcecode.all.tags("span")(6).innertext
' Debug.Print HTMLsourcecode.all.tags("span")(7).innertext
' Debug.Print HTMLsourcecode.all.tags("span")(8).innertext
' Debug.Print HTMLsourcecode.all.tags("span")(9).innertext
' Debug.Print HTMLsourcecode.all.tags("span")(10).innertext
' Debug.Print HTMLsourcecode.all.tags("span")(11).innertext
' Debug.Print HTMLsourcecode.all.tags("span")(12).innertext
' Debug.Print HTMLsourcecode.all.tags("span")(13).innertext
' Debug.Print HTMLsourcecode.all.tags("span")(14).innertext
' Debug.Print HTMLsourcecode.all.tags("span")(15).innertext
' Debug.Print HTMLsourcecode.all.tags("span")(16).innertext
' Debug.Print HTMLsourcecode.all.tags("span")(17).innertext
' Debug.Print HTMLsourcecode.all.tags("span")(18).innertext




End With
Set HTMLsourcecode = Nothing 'ÄÀ©ñ°O¾ÐÅé
Set GetXml = Nothing
End Sub '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TOP

¦^´_ 2# wufonna


    http://forum.twbts.com/viewthrea ... p;extra=&page=2

01 ===>>> #1173

TOP

¦^´_ 3# quickfixer


    ÁÂÁÂ ¤j¤j
´N¬O³oµ{¦¡¡A³Ìªñºô­¶¤S§ïª©¤F¡A®»¤£¨ì ·l¯qªí ªº½è®Æ¡A¤§«e¬O table,²{¦b§ï¬°div¤º¡AµLªk®»ªí®æ¡C

TOP

¦^´_ 4# wufonna

¨º­Ó#1173,§Ú¥u§ïºô§},®M¥Îok³á

   

TOP

¦^´_ 3# quickfixer
½Ð¤j¤j ¥i¥H¶K¤Wµ{¦¡¶Ü¡H
§Ú𧥾¤£¨ì 01 ===>>> #1173
ÁÂÁÂ

TOP

  1. Private Sub GetIncome(ByVal ss As String) '¨ú·l¯qªí(¦~ªí)ºô­¶
  2. Dim Url, HTMLsourcecode, GetXml, TableG, i, j
  3. Set HTMLsourcecode = CreateObject("htmlfile")
  4. Set GetXml = CreateObject("msxml2.xmlhttp")
  5. Url = "http://kgieworld.moneydj.com/z/zc/zcq/zcqa/zcqa_" & ss & ".djhtm"
  6. With GetXml
  7. .Open "GET", Url, False
  8. .Send

  9. HTMLsourcecode.body.innerhtml = .Responsetext
  10. Set TableG = HTMLsourcecode.all.tags("table")(2).Rows
  11. For i = 0 To TableG.Length - 1
  12. For j = 0 To TableG(i).Cells.Length - 1
  13. ¤u§@ªí4.Cells(i + 1, j + 1) = TableG(i).Cells(j).innertext
  14. Next j
  15. Next i
  16. End With
  17. Set HTMLsourcecode = Nothing 'ÄÀ©ñ°O¾ÐÅé
  18. Set GetXml = Nothing
  19. End Sub '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
½Æ»s¥N½X
¤§«eªº®»¤£¨ì

TOP

¦^´_ 7# wufonna


    f3202¤j¤j,¦b 2019-6-18 07:55  #11 µ¹§Aªº01ºô§}
¥hºô§}¸Ì­±ªº2021-12-24 18:11 #1173 ªº¤å³¹copy:@

TOP

¦^´_ 8# quickfixer


   §ä¨ì¤F  ÁÂÁ ¤j¤j  §Ú¦b¸Õ¬Ý¬Ý

TOP

¦^´_ 1# wufonna
ÁÂÁ ¤j¤j §ï¦n¤F

GetDividend-(2020-01-05).rar (56.16 KB)

TOP

        ÀR«ä¦Û¦b : ¥Í®ð¡A´N¬O®³§O¤Hªº¹L¿ù¨ÓÃg»@¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD