ªð¦^¦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ÁÂÁÂ
Image 1.jpg
2022-1-4 17:13

§Ú¸ÕµÛ¤@­Ó¤èª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

¦^´_ 3# quickfixer


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

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

¦^´_ 8# quickfixer


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

TOP

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

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

TOP

¥»©«³Ì«á¥Ñ wufonna ©ó 2022-1-6 19:04 ½s¿è

¦^´_ 1# wufonna

ª÷¿Ä«OÀI·~ §O ªºªí®æ®æ¦¡¤£¤@¼Ë §ì¤£¨ì¥¿½Tªº¸ê®Æ
§Ú¬O¨ú
ROE=·l¯qªí-µ|«e²b§Q(67)/¸ê²£­t¶ÅªíªÑ-ªFÅv¯qÁ`ÃB(95)
.Cells(i, 9).Value = ¤u§@ªí4.Cells(67, 2).Value / ¤u§@ªí5.Cells(95, 2).Value 'ROE%
¨D§ï¥¿¤èªk ÁÂÁÂ

ªþÀɬO§ì¨ìªº¸ê®Æ

GetDividend-2022-1-6.rar (230.62 KB)

TOP

¦^´_ 1# wufonna
  1. Sub test()
  2. Debug.Print "test"


  3. With Sheet1
  4.   Debug.Print .Columns("A").Find("µ|«e²b§Q").Row
  5.   Debug.Print .Range("b" & Sheet1.Columns("A").Find("µ|«e²b§Q").Row).Value
  6.   
  7.   Debug.Print .Rows("67").Find(-336).Column
  8.   Debug.Print .Rows("67").Find("-336").Column
  9.   Debug.Print .Rows("67").Find("52").Column
  10.             
  11.   Debug.Print .Rows("67").Find(0).Column '§ä¨ì101¤ºªº0

  12. End With

  13. End Sub
½Æ»s¥N½X
¬ö¿ý¤@¤U

testest.rar (17.45 KB)

TOP

  1. '          .Cells(i, 9).Value = ¤u§@ªí4.Cells(67, 2).Value / ¤u§@ªí5.Cells(95, 2).Value 'ROE%
  2.            .Cells(i, 9).Value = ¤u§@ªí4.Range("b" & ¤u§@ªí4.Columns("A").Find("µ|«e²b§Q").Row).Value / ¤u§@ªí5.Range("b" & ¤u§@ªí5.Columns("A").Find("ªÑªFÅv¯qÁ`ÃB").Row).Value 'ROE% ¤£©T©w¦ì¤l
½Æ»s¥N½X
¦^´_ 1# wufonna

­×¸Ó¤ù¬q

TOP

        ÀR«ä¦Û¦b : ª¾ÃÑ­n¥Î¤ßÅé·|¡A¤~¯àÅܦ¨¦Û¤vªº´¼¼z¡C
ªð¦^¦Cªí ¤W¤@¥DÃD