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

[µo°Ý] µLªk¥Î¥~³¡¸ê®Æ¶×¤Jªººô¯¸¯à¥ÎVBAŪ¨ú¸ê®Æ¶Ü¡H

¦^´_  ¤p«L«È Set A = .Document.getElementsByTAGName("TD")
¤£©ñ¦b Do   Loop °j°é¤]¥i¥H,
¦ý¦]ºô­¶¸ê®Æ ...
GBKEE µoªí©ó 2014-6-20 21:03


­ì¨Ó¦p¦¹¡A¦]¬°§Ú¬O¥Î¡u³v¦æ°õ¦æ¡vªº¤è¦¡¬ã¨s¥N½X¡A©Ò¥H¤ñ¸û¨S¦³³o­Ó°ÝÃD¡A¹ê»Ú¹B¦æ½T»Ý­n§@³o­Óchecking¡C
¨º»òa.length = 84¤S¬O¬Æ»ò·N«ä¡H

A = ¡uªð¦^±a¦³TD¼Ðñ¦Wªº¹ï¶H¶°¦X¡v
A.Length ¬O«ü³o­Ó¶°¦XªºÁ`¼Æ
¦ý§Ú°Ñ¦Ò ¡uPrivate Sub ºô­¶ªº¤¸¯À()¡v
§Úµo²{¥u¦³54­ÓTD ......

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-6-23 09:43 ½s¿è

¦^´_ 11# ¤p«L«È
  1. 'ºô­¶·j´Mµ²ªG: 0 °O¿ý
  2. Option Explicit
  3. Sub IE¤U¤@­¶()
  4.     Dim url As String, a As Object, Table As Object, i As Integer, pubSrch As Object, Pages As Integer
  5.     Dim Sh As Worksheet, B As String, E
  6.     Set Sh = ActiveSheet
  7.     Sh.Cells.Clear
  8.     '************************************
  9.     url = "https://eservices.customs.gov.hk/MSOS/wsrh/001s1?"  
  10.    'url = "https://eservices.customs.gov.hk/MSOS/wsrh/001s1?"searchBy=A"  'ºô­¶¦³¸ê®Æ
  11.     '************************************
  12.     With CreateObject("InternetExplorer.Application")
  13.         .Visible = True     '  ¬O§_Åã¥Ü IE
  14.         .Navigate url
  15.         Do While .ReadyState <> 4 Or .Busy
  16.             DoEvents
  17.         Loop
  18.         Do
  19.             Set a = .Document.getElementsByTAGName("TD")
  20.         Loop Until Not a Is Nothing 'And a.Length = 84
  21.         On Error Resume Next
  22.         With Sh
  23.             For i = 0 To a.Length - 1
  24.                 .Cells(i + 1, "A") = i
  25.                 .Cells(i + 1, "B") = a(i).Type
  26.                 .Cells(i + 1, "C") = a(i).ID
  27.                 .Cells(i + 1, "D") = a(i).InnerText
  28.                 .Cells(i + 1, "E") = a(i).Value
  29.             Next
  30.             
  31.         End With
  32.         
  33.         .Quit
  34.     End With
  35.     MsgBox "getElementsByTAGName(""TD"") ¦X­p " & a.Length
  36. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : «H¤ß¡B¼Ý¤O¡B«i®ð¤TªÌ¨ã³Æ¡A«h¤Ñ¤U¨S¦³°µ¤£¦¨ªº¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD