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

½Ð°Ý³o­Óºô­¶¦p¦ó¥ÎWEB¬d¸ß¿é¤Jexcel

¦^´_ 4# jewayy

  1. Option Explicit
  2. Dim IE As Object
  3. Sub ¥X¤f³ø³æ©ñ¦æ¸ê®Æ¬d¸ß()
  4.     Dim ¥X¤f³ø³æ¸¹½X As String, n As Object
  5.         ¥X¤f³ø³æ¸¹½X = InputBox("¥X¤f³ø³æ¸¹½X", "¥X¤f³ø³æ©ñ¦æ¸ê®Æ¬d¸ß", "BE  02XE580024")
  6.         If ¥X¤f³ø³æ¸¹½X = "" Then Exit Sub
  7.         With CreateObject("InternetExplorer.Application")
  8.            .Visible = True
  9.             .Navigate "http://portal.sw.nat.gov.tw/APGQ/GB315?request_locale=zh_TW&declNo=" & ¥X¤f³ø³æ¸¹½X
  10.             Do While .Busy = True
  11.         DoEvents
  12.         Loop
  13.         For Each n In .document.getelementsbytagname("INPUT")
  14.            If n.Value = "¬d¸ß" Then
  15.                 n.Click                        'ºô­¶«ö¤U ¬d¸ß
  16.                 Exit For
  17.            End If
  18.         Next
  19.         Application.Wait (Time + TimeValue("0:00:03"))  '¨Ìºô­¶¤U¸ü³t«×½Õ¾ãµ¥«Ý¬í¼Æ
  20.         Set IE = .document
  21.         ¬d¸ßµ²ªG
  22.         .Quit
  23.     End With
  24. End Sub
  25. Private Sub ¬d¸ßµ²ªG()
  26.     Dim Ar(1 To 7), SH As Worksheet
  27.     '***** ºô­¶ªº­ì©lÀɮתº¥»¤å
  28.     '<tbody><tr><td colspan="4" class="resultHeader">¬d¸ßµ²ªG</td></tr>
  29.     '<td class="resultHeader">®üªÅ¹B§O</td><td class="result" id="transTypeCd">®ü</td>
  30.     '<td class="resultHeader" width="25%">¥X¤f³ø³æ¸¹½X</td><td width="25%" class="result" id="declNo">BE  02XE580024</td>
  31.     '<td class="resultHeader" width="25%">³ø³æÃþ§O</td><td width="25%" class="result" id="declType">G5</td>
  32.     '<td class="resultHeader" width="25%">Á`¥ó¼Æ</td><td width="25%" class="result" id="totPackQty">32</td>
  33.     '<td class="resultHeader" width="25%">¥Øªº°ê®a¥N½X</td><td width="25%" class="result" id="destCd">VNCLI</td>
  34.     '<td class="resultHeader" width="25%">Á`¥ó¼Æ³æ¦ì</td><td width="25%" class="result" id="totPackQtyUnit">PLT</td>
  35.     '<td class="resultHeader" width="25%">³ø³æ©ñ¦æµù°O</td><td width="25%" class="result" id="examRelNote">Y</td>
  36.     '<td class="resultHeader" width="25%">Á`¤ò­«</td><td width="25%" class="result" id="totGrossWeight">49376</td>
  37.     '<td class="resultHeader" width="25%">©ñ¦æ¤é´Á</td><td width="25%" class="result" id="relDate">102/09/17</td>
  38.     '<td class="resultHeader" width="25%">²î²í¦WºÙ(®ü)/¯è¾÷¦WºÙ(ªÅ)</td><td width="25%" class="result" id="vslName">UNI-PROSPER                        </td>
  39.     '<td class="resultHeader" width="25%">¾P¿µµù°O</td><td width="25%" class="result" id="marketMftNote">Y</td>
  40.     '<td class="resultHeader" width="25%">²î²í¯è¦¸(®ü)/¯è¾÷¯Z¦¸(ªÅ)</td><td width="25%" class="result" id="voyageFlightNo">1084-186S</td>
  41.     '<td class="resultHeader" width="25%">²î²í©I¸¹(®ü)</td><td width="25%" class="result" id="vslSign">BKHC</td>
  42.     '<input id="statusMsg" type="text" class="msgText uppercase" readonly="readonly" style="width: 775px; color: red;">
  43.      Set SH = ActiveSheet                                 '«ü©wÅã¥Ü¸ê®Æªº¤u§@ªí 'ActiveSheet->§@¥Î¤¤ªº¤u§@ªí
  44.     If InStr(IE.getElementById("statusMsg").Value, "[°õ¦æ¦¨¥\]") = 0 Then
  45.         SH.[b2].Resize(7, 1) = Application.WorksheetFunction.Transpose(Ar)
  46.         SH.[d2].Resize(7, 1) = Application.WorksheetFunction.Transpose(Ar)
  47.         Exit Sub
  48.     End If
  49.     Ar(1) = IE.getElementById("transTypeCd").innertext      '®üªÅ¹B§O
  50.     Ar(2) = IE.getElementById("declNo").Value               '¥X¤f³ø³æ¸¹½X
  51.     Ar(3) = IE.getElementById("totPackQty").innertext       'Á`¥ó¼Æ
  52.     Ar(4) = IE.getElementById("totPackQtyUnit").innertext   'Á`¥ó¼Æ³æ¦ì
  53.     Ar(5) = IE.getElementById("totGrossWeight").innertext   'Á`¤ò­«
  54.     Ar(6) = IE.getElementById("vslName").innertext          '²î²í¦WºÙ (®ü) / ¯è¾÷¦WºÙ(ªÅ)
  55.     Ar(7) = IE.getElementById("voyageFlightNo").innertext   '²î²í¯è¦¸ (®ü) / ¯è¾÷¯Z¦¸(ªÅ)
  56.     SH.[b2].Resize(7, 1) = Application.WorksheetFunction.Transpose(Ar)
  57.     Ar(1) = ""
  58.     Ar(2) = IE.getElementById("declType").innertext         '³ø³æÃþ§O
  59.     Ar(3) = IE.getElementById("destCd").innertext           '¥Øªº°ê®a¥N½X
  60.     Ar(4) = IE.getElementById("examRelNote").innertext      '³ø³æ©ñ¦æµù°O
  61.     Ar(5) = IE.getElementById("totGrossWeight").innertext   '©ñ¦æ¤é´Á
  62.     Ar(6) = IE.getElementById("marketMftNote").innertext    '¾P¿µµù°O
  63.     Ar(7) = IE.getElementById("vslSign").innertext          '²î²í©I¸¹ (®ü)
  64.     SH.[d2].Resize(7, 1) = Application.WorksheetFunction.Transpose(Ar)
  65.     SH.Columns.AutoFit
  66. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

http://portal.sw.nat.gov.tw/APGQ/GB315!query?declNo=BE++02XE580024

¤º®e¬Ojson®æ¦¡
{"msg":"[°õ¦æ¦¨¥\]","transTypeCd":"®ü","totGrossWeight":49376,"destCd":"VNCLI","totPackQty":"32","declType":"G5","relDate":"102\/09\/17","totPackQtyUnit":"PLT","declNo":"BE  02XE580024","vslSign":"BKHC","examRelNote":"Y","voyageFlightNo":"1084-186S","marketMftNote":"Y","status":"ok","vslName":"UNI-PROSPER                        "}




¥i¯à­n¤Uxmlhttp¤U¸ü
¥iªG­n¥Îexcel   web¬d¸ß¡A§Ú¸Õ¹L·|¶Ã½X¡A¥i¯àÁÙ­n·|Âà½X

´N­n¥Îieªk§ä¨ìtag«ö¤U¥h¡A±qùØ­±§ätable

´£¨Ñ¨â­Óºô­¶°Ñ¦Ò¡G
http://club.excelhome.net/forum.php?mod=viewthread&action=printable&tid=939881

http://blog.csdn.net/a814153a/article/details/9071577

TOP

¦^´_ 5# jewayy
§Ú¸Õ¹Lª½±µµ¹ºô§}¦ü¥Gºô¯¸¨Ã¤£·|¥¿±`Åã¥Ü¸ê®Æ,
¥t¥~±q¿é¤J¸ê®Æ«á«ö¬d¸ß«ö¯Ã®É,
¤W¤èªººô§}¤]¨Ã¨S¦³¦]¦ÓÅÜ°Ê.

©Î³\§AÀ³¸Ó§ï¦¨¥Îµ{¦¡¦b ¥X¤f³ø³æ¸¹½X¡G ®Çªº¿é¤J®Ø¿é¤J¸ê®Æ,
µM«á¼ÒÀÀ«ö¤U ¬d¸ß «ö¯Ã¸û©ö¦¨¥\¬d¸ß¨ì¸ê®Æ.

¤£¹L¦]¬°§Ú¤]¤£¤ÓÀ´ Excel VBA Ū¨úºô­¶¬ÛÃö¤è¦¡,
³o´N»Ý­n¨ä¥L¤H¨Ó¸Ñµª¤F.

TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2013-11-16 17:36 ½s¿è
ÁÂÁ±zªº¦^ÂСA¤£¹L¦n¹³ÁÙ¬O¨S¦³¤ÏÀ³¡C

¤p§Ì¦A´y­z²M·¡¤@¤U¡A¥X¤f³ø³æ¸¹½X"BE  02XE580024"¡ABE»P02XE¤¤ ...
jewayy µoªí©ó 2013-11-16 17:28

¨º´N§ï¦¨    BE%20%2002XE580024
  1. http://portal.sw.nat.gov.tw/PPL/pages/integration/layout.jsp?appId=APGQAGB315declNo=BE%20%2002XE580024
½Æ»s¥N½X

TOP

ÁÂÁ±zªº¦^ÂСA¤£¹L¦n¹³ÁÙ¬O¨S¦³¤ÏÀ³¡C

¤p§Ì¦A´y­z²M·¡¤@¤U¡A¥X¤f³ø³æ¸¹½X"BE  02XE580024"¡ABE»P02XE¤¤¶¡¬O¥²¶·¦³¨â­ÓªÅ®æ¤~¯à¬d¸ß¦¨¥\¡C
µe­±¬d¸ßµ²ªG¦p¤U¡G


¦A³Â·Ð¦U¦ìµ¹¤©¤ä´©¡AÁÂÁ¡C
Hi~

TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2013-11-16 15:15 ½s¿è
http://portal.sw.nat.gov.tw/PPL/pages/integration/layout.jsp?appId=APGQAGB315

¥X¤f³ø³æ¸¹½X¡GBE  0 ...
jewayy µoªí©ó 2013-11-15 22:02

¥X¤f³ø³æ¸¹½X¡GBE  02XE580024 ¸Õ¸Õ¦¨ BE%2002XE580024
  1. http://portal.sw.nat.gov.tw/PPL/pages/integration/layout.jsp?appId=APGQAGB315declNo=BE%2002XE580024
½Æ»s¥N½X

TOP

¨þ¨þ¡AÁÂÁ±zªº¦^ÂСA³Q»¡ªº¦n¹³¬O¤£À´ª¦¤åªº¤p¥Õ~~
¤§«e¤p§Ì¼g³oºØWEB¶×¤J¤]¤£¤U10­Ó(©Î³\¨º¨Çºô­¶¤ñ¸û¾A¦X¦Û¤v²Ê²Lªº¥\¤O)¡A
¦bµo¤å¤§«e¤]ª¦¹L¤å¡A¹ê¦b§ä¤£¨ì¸Ñ¨Mªº¤èªk¤~¨D±Ï¤j®aªº¡C

¤£¾å±o°ª¤â¦p±z¬O§_¦³§ó¨ã«Øij©Êªº¦^ÂСA¦b¦¹¦hÁ¡C
Hi~

TOP

        ÀR«ä¦Û¦b : ÁÀ¨¥¹³¤@¦·²±¶}ªºÂAªá¡A¥~ªí¬üÄR¡A¥Í©Rµu¼È¡C
ªð¦^¦Cªí ¤W¤@¥DÃD