Board logo

¼ÐÃD: ½Ð°Ý³o­Óºô­¶¦p¦ó¥ÎWEB¬d¸ß¿é¤Jexcel [¥´¦L¥»­¶]

§@ªÌ: jewayy    ®É¶¡: 2013-11-15 22:02     ¼ÐÃD: ½Ð°Ý³o­Óºô­¶¦p¦ó¥ÎWEB¬d¸ß¿é¤Jexcel

http://portal.sw.nat.gov.tw/PPL/pages/integration/layout.jsp?appId=APGQAGB315

¥X¤f³ø³æ¸¹½X¡GBE  02XE580024

§Æ±æ¯à±N¬d¸ßµ²ªG¡A¶×¤JEXCEL¤¤¡A
¤p§Ì¤w¸g°µ¤F¤@­Óiqy,¦p¤U©Ò¥Ü¡A¦ýÁÙ¬OµLªkÅã¥Ü¡A½Ð¦U¦ì¥ý¶iÀ°¦£¡A·P¿E¤£ºÉ¡I
----------------------------------------------------------------------------------------------
WEB
1
http://portal.sw.nat.gov.tw/PPL/pages/integration/layout.jsp?appId=APGQAGB315declNo=BE  02XE580024

Selection=1
Formatting=None
----------------------------------------------------------------------------------------------
§@ªÌ: jewayy    ®É¶¡: 2013-11-16 14:03

¨þ¨þ¡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
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-16 15:13

¥»©«³Ì«á¥Ñ 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

§@ªÌ: jewayy    ®É¶¡: 2013-11-16 17:28

ÁÂÁ±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
[attach]16739[/attach]

¦A³Â·Ð¦U¦ìµ¹¤©¤ä´©¡AÁÂÁ¡C
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-16 17:34

¥»©«³Ì«á¥Ñ 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

§@ªÌ: luhpro    ®É¶¡: 2013-11-16 23:03

¦^´_ 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.
§@ªÌ: joey0415    ®É¶¡: 2013-11-17 00:20

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                        "}

[attach]16745[/attach]


¥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
§@ªÌ: GBKEE    ®É¶¡: 2013-11-17 07:16

¦^´_ 4# jewayy

[attach]16746[/attach]
  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

§@ªÌ: c_c_lai    ®É¶¡: 2013-11-17 08:12

¦^´_ 8# GBKEE
  1. Ar(2) = IE.getElementById("declNo").Value                   '¥X¤f³ø³æ¸¹½X
½Æ»s¥N½X
­n§ï¦¨
  1. Ar(2) = IE.getElementById("declNo").innertext            '¥X¤f³ø³æ¸¹½X
½Æ»s¥N½X
¤~¤£·|²£¥Í 438ªº¿ù»~°T®§¡C
«Ü´Îªº¸àÄÀ¡I¶¶±a½Ð±Ð¤@¤U¡A¦pªG§Ú­n³s¦P¨C­Ó¼ÐÃD (¦p¡G¬d¸ßµ²ªG¡B®üªÅ¹B§O¡B¥X¤f³ø³æ¸¹½Xµ¥)
¤@¨Ö¤U¸ü¡AÀ³¸Ó­n¦p¦ó³B²z¡H
ÁÂÁ±z¡I
§@ªÌ: GBKEE    ®É¶¡: 2013-11-17 08:55

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-11-17 09:06 ½s¿è

¦^´_ 9# c_c_lai
EXCEL 2003, IE 8  ©Î³\¬Oª©¥»¤£¦P  declNo=>tagname("INPUT") ­n¥Î VALUE
IE8   Ar(2) = IE.getElementById("declNo").innertext      '¥X¤f³ø³æ¸¹½X  ·|¶Ç¦^ ªÅ¦r¦ê
­n³s¦P¨C­Ó¼ÐÃD¶Ü §Ú@*#@*#@*#

°Ñ¦Ò7# joey0415  µ¹ªººô§} http://portal.sw.nat.gov.tw/APGQ/GB315!query?declNo=BE++02XE580024
¥i±Ë¥h8#ªºµ{¦¡½X ,  ¦p¦b 8# ¹Ï¤ùªº¤u§@ªí,³oµ{¦¡½X´N²«K¤F.
  1. Option Base 1
  2. Sub Ex()
  3.     Dim Ar, AA(), ¥X¤f³ø³æ¸¹½X As String, Sh As Worksheet
  4.     ¥X¤f³ø³æ¸¹½X = InputBox("¥X¤f³ø³æ¸¹½X", "¥X¤f³ø³æ©ñ¦æ¸ê®Æ¬d¸ß", "BE  02XE580024")
  5.     If ¥X¤f³ø³æ¸¹½X = "" Then Exit Sub
  6.     Set Sh = ActiveSheet                                 '«ü©wÅã¥Ü¸ê®Æªº¤u§@ªí 'ActiveSheet->§@¥Î¤¤ªº¤u§@ªí
  7.     With CreateObject("Microsoft.XMLHTTP")
  8.        .Open "GET", "http://portal.sw.nat.gov.tw/APGQ/GB315!query?declNo=" & ¥X¤f³ø³æ¸¹½X, False
  9.         .send
  10.         Ar = Split(Replace(.responsetext, """", ""), ",")
  11.         AA = Array(1, 8, 4, 7, 2, 14, 11)           'Aø󪺼ÐÃD¤º®e Ar¤¤°}¦C¹ïÀ³¤§¯Á¤Þ­È
  12.         On Error GoTo Er                            '¥X¤f³ø³æ¸¹½X ¤£¥¿½T·|¦³¿ù»~:
  13.         For i = 1 To UBound(AA)
  14.             Sh.Cells(1 + i, "B") = Split(Ar(AA(i)), ":")(1)  'Bøó
  15.        Next
  16.        AA = Array(5, 3, 10, 6, 12, 9)                 'Cø󪺼ÐÃD¤º®e Ar¤¤°}¦C¹ïÀ³¤§¯Á¤Þ­È
  17.        For i = 1 To UBound(AA)
  18.             Sh.Cells(2 + i, "D") = Split(Ar(AA(i)), ":")(1)  'Døó
  19.             If AA(i) = 6 Then Cells(2 + i, "D") = Replace(Cells(2 + i, "D"), "\/", "/")
  20.        Next
  21.     End With
  22.     Exit Sub
  23. Er:
  24.     Sh.[b2].Resize(7, 1) = ""
  25.     Sh.[d2].Resize(7, 1) = ""
  26. End Sub
  27. End Sub
½Æ»s¥N½X

§@ªÌ: jewayy    ®É¶¡: 2013-11-17 11:21

ª©¤jªGµM¤Ó±j¤j¤F¡I
®Ú¾Úª©¤jªºcode¡A¥é·Ó¤F¥t¤@­Óºô­¶ªºWEB¿é¤J
portal.sw.nat.gov.tw/PPL/pages/integration/layout.jsp?appId=APGQAGB309
ºô­¶¬d¸ßµe­±¦p¤U¡G
[attach]16747[/attach]
¶×¤JEXCELµe­±¦p¤U¡G
[attach]16748[/attach]
-----------------------------code---------------------------------------
Option Base 1
Sub Ex()
    Dim Ar, AA(), ¥X¤f³ø³æ¸¹½X As String, Sh As Worksheet
    ¥X¤f³ø³æ¸¹½X = InputBox("¥X¤f³ø³æ¸¹½X", "¥X¤f³ø³æ©ñ¦æ¸ê®Æ¬d¸ß", "BE  02XE580024")
    If ¥X¤f³ø³æ¸¹½X = "" Then Exit Sub
    Set Sh = ActiveSheet                                 '«ü©wÅã¥Ü¸ê®Æªº¤u§@ªí 'ActiveSheet->§@¥Î¤¤ªº¤u§@ªí
    With CreateObject("Microsoft.XMLHTTP")
       .Open "GET", "http://portal.sw.nat.gov.tw/APGQ/GB309!query?&choice=D&declNo=" & ¥X¤f³ø³æ¸¹½X, False
        .send
        Ar = Split(Replace(.responsetext, """", ""), ",")
        AA = Array(1, 8, 4, 7, 2, 14, 11)           'Aø󪺼ÐÃD¤º®e Ar¤¤°}¦C¹ïÀ³¤§¯Á¤Þ­È
        On Error GoTo Er                            '¥X¤f³ø³æ¸¹½X ¤£¥¿½T·|¦³¿ù»~:
        For i = 1 To UBound(AA)
            Sh.Cells(1 + i, "B") = Split(Ar(AA(i)), ":")(1)  'Bøó
       Next
       AA = Array(5, 3, 10, 6, 12, 9)                 'Cø󪺼ÐÃD¤º®e Ar¤¤°}¦C¹ïÀ³¤§¯Á¤Þ­È
       For i = 1 To UBound(AA)
            Sh.Cells(2 + i, "D") = Split(Ar(AA(i)), ":")(1)  'Døó
            If AA(i) = 6 Then Cells(2 + i, "D") = Replace(Cells(2 + i, "D"), "\/", "/")
       Next
    End With
    Exit Sub
Er:
    Sh.[b2].Resize(7, 1) = ""
    Sh.[d2].Resize(7, 1) = ""
End Sub
-----------------------------code---------------------------------------
½Ð°Ýª©¤j¦p¦ó§â¤º®eªº¶Ã½X§ó§ï¦¨¥¿½Tªº¤¤¤åÅã¥Ü¡A¦p¡G«Ø·s°ê»ÚªÑ¥÷¦³­­¤½¥q°ª¶¯¤À¤½¥q¡Aªøºa°ê»Ú...

¨ä¹ê¡A¦Û¤v¤ñ¸û°½Ãi¡A°µªºiqy¥u¦³¥H¤U²³æ¤º®e¡A°Ñ·ÓEXCEL¤ºªº³ø³æ¸¹½X¥i°µ§å¦¸ªº¬d¸ß¡A
¥u¬O¦^¶Çªºµ²ªG¦pjoey0415¥S»¡ªº·|¦³¶Ã½X¡A¦pªG¦³¤èªk¥i¥H¸Ñ¨M¦^¶Ç¶Ã½Xªº¸Ü´N¤Ó¦n¤F~~
------------------------------------------
WEB
1
http://portal.sw.nat.gov.tw/APGQ/GB309!query
choice=D&declNo=["ID",""]

Selection=1
Formatting=None
------------------------------------------
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-17 12:29

¦^´_ 10# GBKEE
·PÁ¡A Ex() °õ¦æ¥X¨Óªºµ²ªG¹êµLªk¤J¥Ø¡AÁÙ¬O±z­ì¨Óªºµ{¦¡½X¸û¨Î¡A
¦Ü©ó "¼ÐÃD" ªº°ÝÃD§Ú¶i¤J Html ¬Ý¤F¤@¤U¡AÁŵM¤j®©¡A­ì¨Ó¥¦¬O
¨Ï¥Î <TD> </TD> ³B­ù¡A©Ò¥H¤]¥u¦n·Ó³æ¤J®y¤F¡C
§@ªÌ: joey0415    ®É¶¡: 2013-11-17 12:37

¦^´_ 10# GBKEE

½Ð°Ý¶W¯Åª©¥D

³z¹L±zªº¤èªk¡A¤j·§ª¾¹D«ç»ò¤Á¡A§Ú¥u·|ª©¥Dªº¤è¦¡­×§ï¦p¤U¡G
  1.     Sub Ex()
  2.         Dim Ar, AA(), ¥X¤f³ø³æ¸¹½X As String, Sh As Worksheet
  3.         ¥X¤f³ø³æ¸¹½X = InputBox("¥X¤f³ø³æ¸¹½X", "¥X¤f³ø³æ©ñ¦æ¸ê®Æ¬d¸ß", "BE  02XE580024")
  4.         If ¥X¤f³ø³æ¸¹½X = "" Then Exit Sub
  5.         Set Sh = ActiveSheet                                 '«ü©wÅã¥Ü¸ê®Æªº¤u§@ªí 'ActiveSheet->§@¥Î¤¤ªº¤u§@ªí
  6.         With CreateObject("Microsoft.XMLHTTP")
  7.            .Open "GET", "http://portal.sw.nat.gov.tw/APGQ/GB315!query?declNo=" & ¥X¤f³ø³æ¸¹½X, False
  8.             .send
  9.             Ar = Split(Replace(.responsetext, """", ""), ",")
  10.             For i = 0 To UBound(Ar)
  11.                 Sh.Cells(1 + i, 1) = Ar(i)  'Bøó
  12.            Next
  13.            
  14.             For i = 0 To UBound(Ar)
  15.                 Sh.Cells(1 + i, 2) = Split(Sh.Cells(1 + i, 1), ":")(0) 'Bøó
  16.                 Sh.Cells(1 + i, 3) = Split(Sh.Cells(1 + i, 1), ":")(1) 'Bøó
  17.            Next
½Æ»s¥N½X
[attach]16749[/attach]

½Ð°Ýª©¥D¡G
AA = Array(1, 8, 4, 7, 2, 14, 11)           'Aø󪺼ÐÃD¤º®e Ar¤¤°}¦C¹ïÀ³¤§¯Á¤Þ­È
AA = Array(5, 3, 10, 6, 12, 9)                 'Cø󪺼ÐÃD¤º®e Ar¤¤°}¦C¹ïÀ³¤§¯Á¤Þ­È

¬O¬°¤F¤è«K«ü©wAR°}¦C¤¤«ü©wªº¤¸¯À¡A¦b©ñ¶i·Q­nªºCELLS¤¤¶Ü¡H

============================
           On Error GoTo Er                            '¥X¤f³ø³æ¸¹½X ¤£¥¿½T·|¦³¿ù»~:

¥¦¸õ¨ì
Er:
        Sh.[b2].Resize(7, 1) = ""
        Sh.[d2].Resize(7, 1) = ""
­nÅý³o¨âÄæ³£³]¬°ªÅ¦r¦ê¶Ü¡H

¦pªG­n§å¦¸§ä100­È©ñ¶i¥h¶]¦^°é¡A¤¤¶¡¦³¿ùªº¸Ü
­n©ñ on error resume next¶Ü¡H
©Î¬O³o¨â­Ó¤è¦¡¦³¤À§O¶Ü¡H

ÁÂÁÂ
§@ªÌ: GBKEE    ®É¶¡: 2013-11-17 15:52

¬O¬°¤F¤è«K«ü©wAR°}¦C¤¤«ü©wªº¤¸¯À¡A¦b©ñ¶i·Q­nªºCELLS¤¤¶Ü?
¦pªG­n§å¦¸§ä100­È©ñ¶i¥h¶]¦^°é¡A¤¤¶¡¦³¿ùªº¸Ü
­n©ñ on error resume next¶Ü¡H
¦^´_ 13# joey0415
¨S¿ù¬O­n©ñ¶i·Q­nªºCELLS.

¦pªG¹w´Á·|¦³¿ù»~ªºµ{¦¡½X¤§«e ¼g¤W on error resume next ,µ{¦¡´N¤@ª½°õ¦æ¤U¥h,¦p¯u¦³¿ù»~§A¬O·|¤£ª¾¹Dªº
¦^´_ 11# jewayy

[attach]16750[/attach]
  1. Option Explicit
  2. Option Base 1
  3. Sub ¤f³ø³æ³qÃö¬yµ{¬d¸ß()
  4.     Dim ¥X¤f³ø³æ¸¹½X As String, Rng As Range, AR, S As Variant, E As Variant, i As Integer, W As String, II As Integer
  5.     Dim Sh As Worksheet
  6.     ¥X¤f³ø³æ¸¹½X = InputBox("¥X¤f³ø³æ¸¹½X", "¥X¤f³ø³æ©ñ¦æ¸ê®Æ¬d¸ß", "BE  02XE580024")
  7.     If ¥X¤f³ø³æ¸¹½X = "" Then Exit Sub
  8.     Set Sh = ActiveSheet
  9.     '«ü©wÅã¥Ü¸ê®Æªº¤u§@ªí 'ActiveSheet->§@¥Î¤¤ªº¤u§@ªí
  10.     Set Rng = Sh.Range("b2:B9, D3:D7, D9, B11, D11")
  11.     '**AR¤º®e: °Ñ·Ó **** ¥X¤f³ø³æ³qÃö¬yµ{¬d¸ß(GB309) ºô­¶ªº­ì©lÀÉ*****
  12.     AR = Array("transTypeCd", "vslRegNo", "declNo", "brokerBoxNoName", "mawb", "hawb", "declType", "relCondSubCd" _
  13.     , "soNo", "custCd", "carrierAgencyCd", "arrangeNo", "examMethod", "debitMark", "firstSendDate", "lastSendDate")
  14.     With CreateObject("Microsoft.XMLHTTP")
  15.        .Open "GET", "http://portal.sw.nat.gov.tw/APGQ/GB309!query?&choice=D&declNo=" & ¥X¤f³ø³æ¸¹½X, False
  16.         .send
  17.         S = Replace(.responsetext, """", "")
  18.     End With
  19.     i = 1
  20.     '*********** ¬d¸ßµ²ªG *****
  21.     For Each E In Rng
  22.         E = ""
  23.         If InStr(S, AR(i)) Then
  24.             W = Mid(Split(Mid(S, InStr(S, AR(i)) + Len(AR(i))), ",")(0), 2)
  25.             E = IIf(InStr(LCase(W), "null"), "", W)
  26.         End If
  27.         i = i + 1
  28.     Next
  29.     '***************³qÃö¬yµ{**********
  30.     AR = Split(S, "data:[")(1)                          'ÄdºI "data:[" «áªº¦r¦ê
  31.     AR = Split(AR, "]")(0)                              'ÄdºI "[" «eªº¦r¦ê
  32.     AR = Replace(Mid(AR, 2, Len(AR) - 2), "null", " ")  '´À´« "null" ¬° " "
  33.     AR = Replace(AR, "T", " ")                          '´À´«  "T"   ¬° " "
  34.     AR = Split(AR, "},{")                               '¥H "},{" ¤À³Î¬°°}¦C
  35.     S = Array(4, 2, 0, 1, 3)
  36.     Sh.Range("A13").CurrentRegion.Offset(1) = ""
  37.     For i = 0 To UBound(AR)
  38.         For II = 0 To UBound(S) - 1
  39.             E = Split(AR(i), ",")(S(II + 1))            '¥H S(II + 1)ªº­È ¨ú±o Split(AR(i), ",")°}¦Cªº¯Á¤Þ­È
  40.             Sh.Cells(i + 14, "A").Offset(, II) = Mid(E, InStr(E, ":") + 1)
  41.         Next
  42.     Next
  43. End Sub
  44. '¥X¤f³ø³æ³qÃö¬yµ{¬d¸ß(GB309) ºô­¶ªº­ì©lÀÉ
  45. '<td class="resultHeader">®üªÅ¹B§O</td><td id="transTypeCd" class="result">
  46. '<td class="resultHeader" width="25%">®üÃö³qÃö¸¹½X</td><td width="25%" id="vslRegNo" class="result">
  47. '<td class="resultHeader" width="25%">¸Ë³f³æ½s¸¹</td><td width="25%" id="soNo" class="result">
  48. '<td class="resultHeader">³ø³æ¸¹½X</td><td id="declNo" class="result">
  49. '<td class="resultHeader">Ãö°Ï¥N½X</td><td id="custCd" class="result">
  50. '<td class="resultHeader">³øÃö·~ªÌ½c¸¹</td><td id="brokerBoxNoName" class="result">
  51. '<td class="resultHeader">¹B¿é·~ªÌ/¥N²z¦æ¥N½X</td><td id="carrierAgencyCd" class="result">
  52. '<td class="resultHeader">°U¹B³æ¥D¸¹</td><td id="mawb" class="result">
  53. '<td class="resultHeader">²z³æ¸¹½X</td><td id="arrangeNo" class="result">
  54. '<td class="resultHeader">°U¹B³æ¤À¸¹</td><td id="hawb" class="result">
  55. '<td class="resultHeader">¥Ó½Ð¼fÅç¤è¦¡</td><td id="examMethod" class="result">
  56. '<td class="resultHeader">³ø³æÃþ§O</td><td id="declType" class="result">
  57. '<td class="resultHeader">©ñ¦æªþ±a±ø¥ó</td><td id="relCondSubCd" class="result">
  58. '<td class="resultHeader">¬O§_¬°¨R°hµ|e¤Æ³ø³æ</td><td id="debitMark" class="result">
  59. '<tr><td colspan="4" class="resultHeader">¶Ç°eÁ`ÃB¥æ¬d¦Ü°]µ|¤¤¤ßªº¤é´Á</td>
  60. '<td class="resultHeader">²Ä¤@¦¸¶Ç°e¤é´Á</td><td id="firstSendDate" class="result">
  61. '<td class="resultHeader">³Ì«á¤@¦¸¶Ç°e¤é´Á</td><td id="lastSendDate" class="result">
½Æ»s¥N½X

§@ªÌ: c_c_lai    ®É¶¡: 2013-11-17 16:55

¦^´_ 14# GBKEE
ÁÂÁ±z¸ÔºÉªº¸Ñ»¡¡A²×©ó°ÝÃD¸Ñ¨M¤F¡C­ì¦]¬O¦­¤W°õ¦æ®É
Åã¥Ü¦b Excel ªí³æ¤Wªº¬O¤@°ï¶Ã½X¡C¤U¤È§Ú¥Î Debug ¤è¦¡
°õ¦æ¤~µoı¬O Explorer ªº¸ÑĶ°ÝÃD¡CIE (10) »P  Firefox ¨âªÌ
ªº Decode ¦³¨Ç·Lªº®t²§¡A¦p³z¹L IE ¶Ç¤J­È·|¦³¶Ã½X¡A¤Ï¤§¡B
«h¤@¤Á¥¿±`¡A ¦p¤U¡G
  1. {"msg":"[°õ¦æ¦¨¥\]","transTypeCd":"®ü","totGrossWeight":49376,"destCd":"VNCLI",
  2.   "totPackQty":"32","declType":"G5","relDate":"102\/09\/17",
  3. "totPackQtyUnit":"PLT","declNo":"BE  02XE580024","vslSign":"BKHC",
  4. "examRelNote":"Y","voyageFlightNo":"1084-186S","marketMftNote":"Y",
  5. "status":"ok","vslName":"UNI-PROSPER                        "}
½Æ»s¥N½X
§Ú±N Ar = Split(Replace(.responsetext, """", ""), ",") µyµy­×§ï¦p¤U¡G
  1. Ar = Split(Trim(Replace(Replace(.responsetext, """", ""), "}", "")), ",")
½Æ»s¥N½X
  1. Ar(0) =  "msg:[°õ¦æ¦¨¥\]"
  2. Ar(1) =  "transTypeCd:®ü"
  3. Ar(2) =  "totGrossWeight":49376
  4. Ar(3) =  "destCd:VNCLI"
  5. Ar(4) =  "totPackQty:32"
  6. Ar(5) =  "declType:G5"
  7. Ar(6) =  "relDate:102\/09\/17"
  8. Ar(7) =  "totPackQtyUnit:PLT"
  9. Ar(8) =  "declNo:BE  02XE580024"
  10. Ar(9) =  "vslSign:BKHC"
  11. Ar(10) =  "examRelNote:Y"
  12. Ar(11) =  "voyageFlightNo:1084-186S"
  13. Ar(12) =  "marketMftNote:Y"
  14. Ar(13) =  "status:ok"
  15. Ar(14) =  "vslName:UNI-PROSPER"
½Æ»s¥N½X
¦p¦¹°õ¦æ°_«KµL·åÒ¯¤F¡AÁÂÁ±z¡I
§@ªÌ: joey0415    ®É¶¡: 2013-11-17 20:52

¥»©«³Ì«á¥Ñ joey0415 ©ó 2013-11-17 20:58 ½s¿è

¦^´_ 15# c_c_lai

Ar = Split(Trim(Replace(Replace(.responsetext, """", ""), "}", "")), ",")

½Ð°Ýµ{¦¡½Xªº³Ì¤¤ªº®Ö¤ß¬l¸Ñ¦¨°}¦C¡A¦A¤À¬l®É»Ý­n¥t©R°}¦C¶Ü¡H§_«h¦A¬l¸Ñ®É

¤ñ¦p¬l¦¨¤­­Ó¤¸¯À¡A¥i¥H¦A¦P®É©¹¤U¤@°_¬l¶Ü¡H

ÁÂÁÂ
============================
§Ú¬Ý¿ù¤F¡A­ì¨Ó¬O¥ý¨ú¥N
" =>ªÅ¦r¦ê
}=>ªÅ¦r¦ê

{=>ªÅ¦r¦ê
\=>ªÅ¦r¦ê

³Ì«á¤~¬l¤À
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-18 07:46

¦^´_ 16# joey0415
  1.         '  http://portal.sw.nat.gov.tw/APGQ/GB315!query?declNo=BE++02XE580024
  2.         '  "GET" ¶Ç¤J (Send) ¤§ XML ¤º®e¡G
  3.         '  {"msg":"[°õ¦æ¦¨¥\]","transTypeCd":"®ü","totGrossWeight":49376,"destCd":"VNCLI",
  4.         '  "totPackQty":"32","declType":"G5","relDate":"102\/09\/17",
  5.         '  "totPackQtyUnit":"PLT","declNo":"BE  02XE580024","vslSign":"BKHC",
  6.         '  "examRelNote":"Y","voyageFlightNo":"1084-186S","marketMftNote":"Y",
  7.         '  "status":"ok","vslName":"UNI-PROSPER                        "}
  8.         AR = Split(Trim(Replace(Replace(.responsetext, """", ""), "}", "")), ",")
  9.         '  ¥ý¥h°£ "¡B¦AªÌ¥h°£ }¡B±µ¤U¨Ó¦A±N«e«áªÅ¥Õ (Space) ²MªÅ¡F³Ì«á¤~³B²z Split() ¨Ã Assign µ¹ AR
  10.         '  Ar :  Variant/String(0 to 14)
  11.         '  Ar(0) =  "msg:[°õ¦æ¦¨¥\]"
  12.         '  Ar(1) =  "transTypeCd:®ü"
  13.         '  Ar(2) =  "totGrossWeight":49376
  14.         '  Ar(3) =  "destCd:VNCLI"
  15.         '  Ar(4) =  "totPackQty:32"
  16.         '  Ar(5) =  "declType:G5"
  17.         '  Ar(6) =  "relDate:102\/09\/17"
  18.         '  Ar(7) =  "totPackQtyUnit:PLT"
  19.         '  Ar(8) =  "declNo:BE  02XE580024"
  20.         '  Ar(9) =  "vslSign:BKHC"
  21.         '  Ar(10) =  "examRelNote:Y"
  22.         '  Ar(11) =  "voyageFlightNo:1084-186S"
  23.         '  Ar(12) =  "marketMftNote:Y"
  24.         '  Ar(13) =  "status:ok"
  25.         '  Ar(14) =  "vslName:UNI-PROSPER"
½Æ»s¥N½X

§@ªÌ: stillfish00    ®É¶¡: 2013-11-18 10:16

  1. Sub TEST11()
  2.     Dim sID As String, sStatus As String
  3.     Dim x
  4.    
  5.     sID = InputBox("¥X¤f³ø³æ¸¹½X", "¥X¤f³ø³æ©ñ¦æ¸ê®Æ¬d¸ß", "BE  02XE580024")
  6.     If sID = "" Then Exit Sub
  7.    
  8.     With CreateObject("InternetExplorer.Application")
  9.         .Visible = True '¬O§_Åã¥ÜIE
  10.         .Navigate "http://portal.sw.nat.gov.tw/APGQ/GB315"
  11.         Do While .readyState <> 4: DoEvents: Loop
  12.       
  13.         Set x = .document.getElementById("myform").getElementsByTagName("input")
  14.         x(0).Value = sID  '¶ñ¤J¸¹½X
  15.         x(1).Click  '¬d¸ß
  16.         Do While .document.getElementById("statusMsg").Value = "": DoEvents: Loop
  17.       
  18.         sStatus = .document.getElementById("statusMsg").Value
  19.         If InStr(sStatus, "[°õ¦æ¦¨¥\]") < 0 Then .Quit: MsgBox sStatus: Exit Sub
  20.                        
  21.         .document.body.innerHTML = .document.getElementById("queryResult").outerHTML
  22.         .execwb 17, 2 'Select All
  23.         .execwb 12, 2 'Copy selection
  24.                
  25.         ActiveSheet.[A1].Select
  26.         ActiveSheet.PasteSpecial Format:="HTML" ', NoHTMLFormatting:=True
  27.         .Quit
  28.     End With
  29. End Sub
½Æ»s¥N½X

§@ªÌ: GBKEE    ®É¶¡: 2013-11-18 11:04

¦^´_ 18# stillfish00
  1. .document.body.innerHTML = .document.getElementById("queryResult").outerHTML
½Æ»s¥N½X
³o©Û¨ü±Ð¤F
§@ªÌ: joey0415    ®É¶¡: 2013-11-18 11:59

¥»©«³Ì«á¥Ñ joey0415 ©ó 2013-11-18 12:00 ½s¿è

¦^´_ 19# GBKEE
  1. .document.body.innerHTML = .document.getElementById("queryResult").outerHTML
½Æ»s¥N½X
§â.outerHTMLªº¶Çµ¹.body.innerHTML   ?

½Ð°Ý¶Wª©¡A³o¥y¸Ü«ç¸Ñ©O¡H

ÁÂÁÂ
§@ªÌ: GBKEE    ®É¶¡: 2013-11-18 14:13

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-11-18 14:16 ½s¿è

¦^´_ 20# joey0415
.document(¤å¥ó).body(¥»Åé).innerHTML(¥N½X,¤å¦r) = .document.getElementById("queryResult").outerHTML(¿é¥Xªº:¥N½X,¤å¦r)
¥i¦b³o¦æµ{¦¡½X³]¤U¤¤Â_ÂI,¬Ý¤@¤Uºô­¶«e«áªºÅܤÆ
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-18 15:25

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2013-11-18 15:27 ½s¿è

¦^´_ 18# stillfish00
½Ð±Ð¤@¤U¡A§Ú§â .Navigate "http://portal.sw.nat.gov.tw/APGQ/GB315" ´«¦¨
.Navigate "http://portal.sw.nat.gov.tw/APGQ/GB309" ¥X¤f³ø³æ³qÃö¬yµ{¬d¸ß

  1.        Set x = .document.getElementById("myform").getElementsByTagName("input")
  2.         x(2).Value = sID     '  ¶ñ¤J¸¹½X    (­ì¥»¬° x(0).Value = sID )
  3.         x(11).Click          '  ¬d¸ß        (­ì¥»¬° x(1).Click )
½Æ»s¥N½X
°õ¦æ¨ì ActiveSheet.PasteSpecial Format:="HTML" «oµo¥Í¤F¿ù»~°T®§¡A
½Ð°ÝÀ³¦p¦ó­×¥¿¤èÄÝ¥¿½T¡H ÁÂÁ§A¡I
§@ªÌ: GBKEE    ®É¶¡: 2013-11-18 15:58

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-11-18 16:06 ½s¿è

¦^´_ 22# c_c_lai
  1. For Each x In .document.getElementsByTagName("input")
  2.              If x.Name = "declNo" Then x.Value = sID
  3.             If x.Value = "¬d¸ß" Then x.Click
  4.         Next
½Æ»s¥N½X
³o¦æ¤]­n­×§ï =0
  1. If InStr(sStatus, "[°õ¦æ¦¨¥\]") = 0 Then .Quit: MsgBox sStatus: Exit Sub
½Æ»s¥N½X

§@ªÌ: c_c_lai    ®É¶¡: 2013-11-18 16:56

¦^´_ 23# GBKEE
¦hÁ¤F¡I
¥¿·í§Ú´ú¸Õ§¹¦¨®É¡A¥¿¦n¥ç¬Ý¨ì±z°e¨Óªº°T®§¡A
¹ï§ÚÀ°§U¬Æ¤j¡A¥ç±N±zªºµùÄÀ¥[¤J¨ÃÀ³¥Î¡A
¦A¦¸¨¥Á¡I
  1. Sub ¥X¤f³ø³æ©ñ¦æ³æ¬d¸ßµ²ªG()
  2.     Dim sID As String, sStatus As String
  3.     Dim x
  4.    
  5.     sID = InputBox("¥X¤f³ø³æ¸¹½X", "¥X¤f³ø³æ©ñ¦æ¸ê®Æ¬d¸ß", "BE  02XE580024")
  6.     If sID = "" Then Exit Sub
  7.    
  8.     With CreateObject("InternetExplorer.Application")
  9.         .Visible = True     '  ¬O§_Åã¥Ü IE
  10.         .Navigate "http://portal.sw.nat.gov.tw/APGQ/GB309"
  11.         
  12.         Do While .readyState <> 4
  13.             DoEvents
  14.         Loop
  15.       
  16.         '  Set x = .document.getElementById("myform").getElementsByTagName("input")
  17.         '  x(1).Value = sID     '  ¶ñ¤J¸¹½X  ("declNo")
  18.         '  x(10).Click          '  ¬d¸ß      ("¬d¸ß")
  19.         '  ¹ï©ó x ªº¹B¥Î¡A¦¹¤W¤U¨âºØªí¹F¤è¦¡¨MªG¤@­P¡FµM¤U¦C¤è¦¡¥iÁקK§PÂ_¤W¤§»~§P±¡¨Æ¡C
  20.         For Each x In .document.getElementsByTagName("input")
  21.             If x.Name = "declNo" Then x.Value = sID
  22.             If x.Value = "¬d¸ß" Then x.Click
  23.         Next
  24.         
  25.         Do While .document.getElementById("statusMsg").Value = ""
  26.             DoEvents
  27.         Loop
  28.       
  29.         sStatus = .document.getElementById("statusMsg").Value
  30.         If InStr(sStatus, "[°õ¦æ¦¨¥\]") <= 0 Then .Quit: MsgBox sStatus: Exit Sub
  31.                               
  32.         .document.body.innerHTML = .document.getElementById("queryResult").outerHTML
  33.         .execwb 17, 2       '  Select All
  34.         .execwb 12, 2       '  Copy selection
  35.                
  36.         ActiveSheet.[A1].Select
  37.         ActiveSheet.PasteSpecial Format:="HTML"     ', NoHTMLFormatting:=True
  38.         .Quit
  39.     End With
  40. End Sub
½Æ»s¥N½X
[attach]16760[/attach]
§@ªÌ: stillfish00    ®É¶¡: 2013-11-18 17:19

¦^´_  joey0415
.document(¤å¥ó).body(¥»Åé).innerHTML(¥N½X,¤å¦r) = .document.getElementById("queryRe ...
GBKEE µoªí©ó 2013-11-18 14:13

¸É¥R¤@¤U innerHTML ©M outerHTML ¤£¦P:
    .getElementById("queryResult").outerHTML ¬O«ü¥]§t¦Û¨­¼ÐÅÒªºhtml¥N½X¡A¦p  <table id="queryResult"><tr>blahblah..</tr></table>
    .getElementById("queryResult").innerHTML ¬O¤£¥]§t¦Û¨­¼ÐÅÒ¡A¥u¦³¤º³¡ªºhtml¥N½X¡A§Y<tr>blahblah..</tr>
§@ªÌ: GBKEE    ®É¶¡: 2013-11-18 17:29

¦^´_ 25# stillfish00
·PÁ¸ɨ¬»¡©ú
¦^´_ 24# c_c_lai
¦pªG³o¨Ç ¥X¤f³ø³æ©ñ¦æ³æ¬d¸ßªººô­¶¬ÛÃþ¦üªº¥i¦p¦¹ (§ï¤@¤Ustillfish00ªºµ{¦¡½X)
  1. Option Explicit
  2. Sub ¥X¤f¬d¸ß()
  3.     Dim sID As String, sStatus As String, URL As String
  4.     Dim x
  5.     URL = InputBox("1:¥X¤f³ø³æ©ñ¦æ¸ê®Æ¬d¸ß(²£ÃÒ±M¥Î)(GB315)" & vbLf & "2:¥X¤f³ø³æ³qÃö¬yµ{¬d¸ß(GB309)", "¥X¤f¸ê®Æ¬d¸ß", 1)
  6.     If URL = "" Or (URL <> "1" And URL <> "2") Then Exit Sub
  7.     URL = IIf(URL = "1", "GB315", "GB309")
  8.     sID = InputBox("¥X¤f³ø³æ¸¹½X", "¥X¤f³ø³æ©ñ¦æ¸ê®Æ" & URL & "¬d¸ß", "BE  02XE580024")
  9.     If sID = "" Then Exit Sub
  10.     URL = "http://portal.sw.nat.gov.tw/APGQ/" & URL & "?&declNo=" & sID   
  11.     With CreateObject("InternetExplorer.Application")
  12.         .Visible = True     '  ¬O§_Åã¥Ü IE
  13.         .Navigate URL
  14.         Do While .readyState <> 4
  15.             DoEvents
  16.         Loop
  17.         For Each x In .document.getElementsByTagName("input")
  18.             If x.Value = "¬d¸ß" Then x.Click: Exit For
  19.         Next
  20.         Do While .document.getElementById("statusMsg").Value = ""
  21.             DoEvents
  22.         Loop
  23.         sStatus = .document.getElementById("statusMsg").Value
  24.         If InStr(sStatus, "[°õ¦æ¦¨¥\]") <= 0 Then .Quit: MsgBox sStatus: Exit Sub
  25.                               
  26.         .document.body.innerHTML = .document.getElementById("queryResult").outerHTML
  27.         .execwb 17, 2       '  Select All
  28.         .execwb 12, 2       '  Copy selection
  29.         With ActiveSheet
  30.             .Cells.Clear
  31.             .[A1].Select
  32.             .PasteSpecial Format:="HTML"
  33.         End With
  34.         .Quit
  35.     End With
  36. End Sub
½Æ»s¥N½X

§@ªÌ: c_c_lai    ®É¶¡: 2013-11-18 18:15

¦^´_ 26# GBKEE
·J¾ãªºÆZ¶K¤ßªº¡A¦b§ÀºÝ§Ú¶¶«K¥[¤W¤F¦Û°Ê½Õ¾ãÄõ¼eªº³B¸Ì¡C
  1.         With ActiveSheet
  2.             .Cells.Clear
  3.             .[A1].Select
  4.             .PasteSpecial Format:="HTML"
  5.             .Cells.EntireColumn.AutoFit     '  ¦Û°Ê½Õ¾ãÄæ¼e
  6.         End With
½Æ»s¥N½X
ÁÂÁÂÅo¡I
§@ªÌ: joey0415    ®É¶¡: 2013-11-18 22:02

¥»©«³Ì«á¥Ñ joey0415 ©ó 2013-11-18 22:04 ½s¿è

¦^´_ 26# GBKEE

½Ð°Ý¶W¯Åª©¥D

¥H³o¤è¦¡¨Ó§ì¹d¨Éºô¨Ó½m²ß®É¡Aµ{¦¡½X¦p¤U
  1.     Sub TEST11()
  2.         Dim x   
  3.         With CreateObject("InternetExplorer.Application")
  4.             .Visible = True '¬O§_Åã¥ÜIE
  5.             .Navigate "http://www.cnyes.com/twstock/Institutional/1101.htm"
  6.             Do While .readyState <> 4: DoEvents: Loop
  7.             Set x = .document.getElementById("a_itrust")
  8.             x.Click  
  9.             Do While .readyState <> 4: DoEvents: Loop
  10.             .document.body.innerHTML = .document.getElementById("tabvl").outerHTML
  11.             .execwb 17, 2 'Select All
  12.             .execwb 12, 2 'Copy selection
  13.             ActiveSheet.[A1].Select
  14.             ActiveSheet.PasteSpecial Format:="HTML" ', NoHTMLFormatting:=True
  15.             .Quit
  16.         End With
  17.     End Sub
½Æ»s¥N½X
¨ì³o¤@¦æ·|¥X¿ù¡A¦p¹Ï
.document.body.innerHTML = .document.getElementById("tabvl").outerHTML

§Ú¥H¹d¦ëºô¤¤ªº§ë«H¶i¥X¬°¨Ò¤l½m²ß

¦A°Ý¤@­Ó§xÂZ«Ü¤[ªº°ÝÃD
.getElementById»P.getElementsByTagName
¦³¨Ç¦³id»Ptagname ¦³¨Ç¥u¦³id ¡A¦³¨Ç¥u¦³tagname
½Ð°Ý¦³¥ý«á±qÄݪºÃö«Y¶Ü¡H

­Y¦³¤÷¤lÃö«Y§â¤l³]¬°xªº¸Ü¡A¨º¤÷¼h´N¤£¯àªí¥Ü¶Ü¡HÁÙ¬O¥ý¤÷¼h¦A¥[¤@­Ó  ¡uÂI¡v

­Y³o¼Ë³]x=.document.getElementById("tabvl") ¥X¿ù

½Ðª©¥D«üÂI¤@¤U

[attach]16762[/attach]
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-19 07:19

¦^´_ 28# joey0415
¸Õ¸Õ³o­Ó¡G
  1. Sub ¹d¨Éºô()
  2.     Dim sID As String, sStatus As String, URL As String
  3.     Dim x
  4.    
  5.     URL = "http://www.cnyes.com/twstock/Institutional/1101.htm"
  6.     With CreateObject("InternetExplorer.Application")
  7.         .Visible = True     '  ¬O§_Åã¥Ü IE
  8.         .Navigate URL
  9.         
  10.         Do While .readyState <> 4
  11.             DoEvents
  12.         Loop
  13.         
  14.         For Each x In .Document.getelementsbytagname("input")
  15.             If x.Value = "¬d¸ß" Then x.Click: Exit For
  16.         Next
  17.                
  18.         .Document.body.innerHTML = .Document.getelementsbytagname("table")(1).outerHTML
  19.         .execwb 17, 2       '  Select All
  20.         .execwb 12, 2       '  Copy selection
  21.         
  22.         With ActiveSheet
  23.             .Cells.Clear
  24.             .[A2].Select
  25.             .PasteSpecial Format:="HTML"
  26.             .Cells.EntireColumn.AutoFit     '  ¦Û°Ê½Õ¾ãÄæ¼e
  27.         End With
  28.         .Quit
  29.     End With
  30. End Sub
½Æ»s¥N½X

§@ªÌ: c_c_lai    ®É¶¡: 2013-11-19 07:22

¦^´_ 28# joey0415
¦]¬°§Úªº FireFox µLªk¨Ï¥Î¤W¶Ç¹Ï¤ù»Pªþ¥ó¡A©Ò¥H¤~¥t¥~¥Î IE ¤W¶Ç
[attach]16764[/attach]
§@ªÌ: GBKEE    ®É¶¡: 2013-11-19 07:36

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-11-19 08:05 ½s¿è

¦^´_ 28# joey0415
¦³¨Ç¦³id»Ptagname ¦³¨Ç¥u¦³id ¡A¦ý¤@©w·|¦³tagname
ºK¨úºô­¶­ì¨ÏÀɤ@¬q¤º®e <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="" />
getElementsBytagname("input")     '·|¬O­ì¨ÏÀÉ©Ò¦³<input type=???  .....>  ªº¶°¦X
getElementsByName("__VIEWSTATE")  '°ß¤@ªº Name
getElementById("__VIEWSTATE")     '°ß¤@ªº Id
  1. Option Explicit
  2. Sub TEST11()
  3.     Dim x
  4.     With CreateObject("InternetExplorer.Application")
  5.         .Visible = True '¬O§_Åã¥ÜIE
  6.         .Navigate "http://www.cnyes.com/twstock/Institutional/1101.htm"
  7.         Do While .readyState <> 4: DoEvents: Loop
  8.         Set x = .document.getElementById("a_itrust")
  9.         x.Click ' Âà¨ì ºô­¶: 'http://www.cnyes.com/twstock/itrust/1101.htm            '
  10.         Do While .readyState <> 4: DoEvents: Loop
  11.         ' .document.body.innerHTML = .document.getElementById("tabvl").outerHTML  'ºô­¶¤å¥ó¤¸¯À¨S³o Id="tabvl"
  12.         .document.body.innerHTML = .document.getElementsBytagname("table")(1).outerHTML  'tagname¦¨­û±q 0 ¶}©l
  13.         .execwb 17, 2 'Select All
  14.         .execwb 12, 2 'Copy selection
  15.         ActiveSheet.[A1].Select
  16.         ActiveSheet.PasteSpecial Format:="HTML" ', NoHTMLFormatting:=True
  17.         .Quit
  18.     End With
  19. End Sub
½Æ»s¥N½X

§@ªÌ: joey0415    ®É¶¡: 2013-11-19 10:31

¦^´_ 30# c_c_lai

·PÁ¤j¤j¤À¨É¡A§Ú¬Q¤Ñ³Ì«á¤]¥Îtable¨Ó§ä
¤£¹L½Ð°Ý¤j¤j.Document.getelementsbytagname("table")(1).outerHTML

¤¤ªº1¬O«ç»òºâªº¡A§Úºâªº¬O2¡Aºô­¶ªºtable¦³©T©wºâªk¶Ü¡H¥Ñ¤W¦Ó¤U¡A¤×¥ª¦Ó¥k¶Ü¡H
·PÁÂ
§@ªÌ: GBKEE    ®É¶¡: 2013-11-19 11:45

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-11-19 11:54 ½s¿è

¦^´_ 32# joey0415
IQY ¬d¸ßÀɪº¤º®e(°ÆÀɦW¬° IQY ,¦s©ó°O¨Æ¥»,¤p§@®a.)
  1. WEB
  2. 1
  3. http://www.cnyes.com/twstock/itrust/1101.htm

  4. '§ë«H¶i¥Xºô­¶ 'Selection => tableªº¯Á¤Þ­È ,IQY¤å¥ó¥Ñ1¶}©lºâ°_, VBAµ{¦¡ ¥Ñ0 ¶}©lºâ°_
  5. Selection=2        

  6. Formatting=None
  7. PreFormattedTextToColumns=True
  8. ConsecutiveDelimitersAsOne=True
  9. SingleBlockTextImport=False
  10. DisableDateRecognition=False
  11. DisableRedirections=False
½Æ»s¥N½X

§@ªÌ: joey0415    ®É¶¡: 2013-11-19 13:30

¦^´_ 33# GBKEE

ÁÂÁª©¥D¡I§Ú¤j·§ª¾¹D¤F¡I
ÁÂÁÂ

½Ð±Ð¤@¤U¡A¹d¦ëºôªººô­¶±`·|©w®É­«·s¾ã²z
­Y­n¥Î¤W­±ªº¤èªk§ì¨ú®É¡A³Ì«á¤£­nquit
¥u·Q­n±Nbody.innertext¤º®e©ñ¤W¥h¡A¤£­nÅý¹d¦ëºô¦A­«·s¾ã²z¦¨­ì¨Óªºµe­±¡A­n¥[¤W¤°»ò»y¥y©O¡H
§@ªÌ: GBKEE    ®É¶¡: 2013-11-19 13:49

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-11-19 13:51 ½s¿è

¦^´_ 34# joey0415
§Ú§â¥¦©ñµÛ¨S¦³[­«·s¾ã²z¦¨­ì¨Óªºµe­±]
­Y­n¥Î¤W­±ªº¤èªk§ì¨ú®É¡A³Ì«á¤£­nquit,¤£quit­n¦ó§@¥Î.
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-19 21:49

¦^´_ 32# joey0415
·j´M "<table"
(0)   <table border='0' cellspacing='0' cellpadding='0'><tr><td width='16%'>
(1)    <table>
                        <h3>ªñ¤@­Ó¤ë¤T¤jªk¤H¶R½æ¶WÁ`ªí</h3>
(2)   <table>
                            <caption>
                                <a href="#">¥~¸ê¶R½æ¶W</a></caption>
(3)   <table>
                            <caption>
                                <a href="#">§ë«H¶R½æ¶W</a></caption>
(4)   <table>
                            <caption>
                                <a href="#">¦ÛÀç°Ó¶R½æ¶W</a></caption>
(5)   <table>
                            <caption>
                                <a href="#">¤T¤jªk¤H¶R½æ¶W</a></caption>
[attach]16785[/attach]
§@ªÌ: joey0415    ®É¶¡: 2013-11-19 22:58

¥»©«³Ì«á¥Ñ joey0415 ©ó 2013-11-19 23:02 ½s¿è

¦^´_ 36# c_c_lai
§Ú«á¨Ó¥Îexcelhome ÂŤѤjªº¤ÀªRªk¡A¥u­n¿é¤Jºô­¶¡A¨C­Ótag¬O­þ¤@­Ó³£¶]¤£±¼¡A«D±`¦n¥Î

ÁÙ¬O·PÁ«üÂI¡A±Ð¾Ç¬Ûªø


[attach]16787[/attach]
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-20 09:37

¦^´_ 37# joey0415
ÁÂÁ§A¡I
¦pªG§Ú·Q­n´ú¸Õ "http://www.cnyes.com/twstock/Institutional/1101.htm"
¸Ó¦p¦óÀ³¥Î "¬d§ä¼ÐÅÒ"¡H
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-20 09:45

¦^´_ 37# joey0415
¥¦¦n¹³µLªkÀË´ú¥X table¡C
§@ªÌ: joey0415    ®É¶¡: 2013-11-20 11:40

¦^´_ 38# c_c_lai


±Nºô§}¶K¦b­º­¶ªº A1

¦A«ö¬d¸ß

ÂIÀ»¸Ó³æ¤¸®æ´N·|¬Ý¨ì¤º®e

[attach]16793[/attach]
§@ªÌ: joey0415    ®É¶¡: 2013-11-20 11:49

¦^´_ 35# GBKEE

¤p§Ì¤S´«¤F¤@­Óºô¯¸
³o­Óºô¯¸§Ú·|¥Î¦n´XºØ¤èªk§ì¤F¡A¥u¤£¹L³o¦¸´«¦¨³oºØ¤è¦¡®É¡A¦pªGª½±µrunµ²ªG¡A·|¥X²{¦p¤U¹Ï¡A¥d¦b¨º¤@¥y¸Ü
ªí®æ("table")(7)¬O¹ïªº¡A¦]¬°¦³¦¨¥\¹L
.document.body.innerHTML = .document.getelementsbytagname("table")(7).outerHTML
[attach]16794[/attach]
¦pªG«öF8¤@¨B¨B°õ¦æ®É¡A¦³®É­Ô·|¦¨¥\¡A¦³®É­Ô·|¥¢±Ñ
  1.     Sub test1()
  2.         Dim URL As String
  3.         ActiveSheet.Cells.Clear
  4.         URL = "http://www.tdcc.com.tw/smWeb/QryStock.jsp"
  5.         With CreateObject("InternetExplorer.Application")
  6.             .Visible = True     '  ¬O§_Åã¥Ü IE
  7.             .Navigate URL
  8.             Do While .readyState <> 4: DoEvents: Loop
  9.             .document.All.tags("option")(7).Selected = True
  10.             .document.getelementsbytagname("input")(1).Value = "2330"
  11.             .document.getelementsbytagname("input")(4).Click
  12.             Do While .readyState <> 4: DoEvents: Loop
  13.             .document.body.innerHTML = .document.getelementsbytagname("table")(7).outerHTML

  14.             .execwb 17, 2       '  Select All
  15.             .execwb 12, 2       '  Copy selection
  16.             
  17.             With ActiveSheet
  18.                 .Cells.Clear
  19.                 .[A1].Select
  20.                 .PasteSpecial Format:="HTML", NoHTMLFormatting:=True
  21.                 .Cells.EntireColumn.AutoFit     '  ¦Û°Ê½Õ¾ãÄæ¼e
  22.             End With
  23.             .Quit
  24.         End With
  25.         
  26.     End Sub
½Æ»s¥N½X

§@ªÌ: c_c_lai    ®É¶¡: 2013-11-20 11:56

¦^´_ 40# joey0415
¤F¸Ñ¡I¦ý¥u¬OµLªk©ú½T¦a¬Ý¥X Table ªº³æ¤¸¡A
§Y (0)¡B(1)¡B(2)¡B .  .  .  .µ¥µ¥¡C
ÁÂÁ¡I
§@ªÌ: GBKEE    ®É¶¡: 2013-11-20 12:37

¦^´_ 41# joey0415
  1. Do While .readyState <> 4: DoEvents: Loop
½Æ»s¥N½X
§ï¦¨
  1. Do While .readyState <> 4 Or .Busy: DoEvents: Loop
½Æ»s¥N½X

§@ªÌ: joey0415    ®É¶¡: 2013-11-20 13:13

¦^´_ 42# c_c_lai


ÂIÀ»innertextªº¸Ó³æ¤¸®æ¡A´N¬Ý¨ì¤º®e§r¡I

[CA4]¨º®æ´Nª¾¹D¤F¡A¯uªº²M·¡¡A©¹¥ª¤@¬Ý´Nª¾¹D¬O«üTABLE 1
§@ªÌ: joey0415    ®É¶¡: 2013-11-20 13:19

¥»©«³Ì«á¥Ñ joey0415 ©ó 2013-11-20 13:27 ½s¿è

¦^´_ 43# GBKEE

½Ð°Ý¶Wª©¡A¥­±`³£­n¥[¸ü§¹¦¨¡A¤~°µ¤U¤@¨B¡I­Y¤£§¹¦¨¡A¥i¯à­n§äªº¸ê®Æ¨S¦³§ä¨ì·|¥X¿ù

¦ÓBUSY »P§¹¥þªº®t²§¤S¦b­þ©O¡H½Ð«ü±Ð¤@¤U

¦pªG¥Dªº¤èªk¬O¥¿½Tªº¡A¨º¥H«á¥u¦³¤U¸ü¦³Ãöªº»yªk³£­n§ï¦¨³o¼Ë¡AÁÙ¬O¥u¦³³oºô¯¸¤~­n¯S§O¦p¦¹©O¡H

ÁÂÁ¶Wª©
==========================
½Ð°Ý¶Wª©¡G
¦pªG¤w¬d¸ß¤@­Óºô§}«á¡A¤w±Nºô¯¸¤º®e§ï¦¨¤U¥y
.document.body.innerHTML = .document.getElementsBytagname("table")
¡A¦pªG¶K¤W«á¡AÁÙ­n¦^¨ì·íªìªºµe­±¦A©¹¤U¬d¥t¤@­Ó¸ê®Æ¡A¦Ó§Ú¤S¤£·Q¦ACREAT¥t¤@­ÓIE¡A¥u·Q¥Î¥Ø«eªºIE¡A¦b¤£­«±Òªº¤è¦¡¤U¡A¦p¦ó¦AÂà¦^·íªìªºµe­±¡A¦A©¹¤U¬d©O¡H
ÁÂÁÂ
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-20 14:01

¦^´_ 44# joey0415
[attach]16798[/attach]
«éµM¤j®©¡AÁÂÁÂÅo¡I
§@ªÌ: ML089    ®É¶¡: 2013-11-20 15:55

¦^´_ 46# c_c_lai

¥i§_¤À¨É¤@¤U¡A§ÚÁÙ¬O¬Ý¤£À´ ^_^
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-20 17:56

¦^´_ 47# ML089
[attach]16803[/attach]
[attach]16804[/attach]
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-20 17:57

¦^´_ 47# ML089
[attach]16805[/attach]
[attach]16806[/attach]
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-20 17:58

¦^´_ 47# ML089
[attach]16807[/attach]
[attach]16808[/attach]
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-20 18:02

¦^´_ 47# ML089
¥H¤W¹Ï¸ÑÁA¸Ñ§_¡H
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-20 19:32

¦^´_ 45# joey0415
°Ñ¦Ò¡G
  1. Sub ¹d¨Éºô()
  2.     Dim URL As String, shts As Worksheet
  3.     Dim x As Variant, xi As Integer
  4.    
  5.     Set shts = Sheets("¤u§@ªí2")
  6.     URL = "http://www.cnyes.com/twstock/Institutional/1101.htm"
  7.    
  8.     With CreateObject("InternetExplorer.Application")
  9.         .Visible = True     '  ¬O§_Åã¥Ü IE
  10.         .Navigate URL
  11.         
  12.         shts.Cells.Clear
  13.         For xi = 1 To 6
  14.             Do While .readyState <> 4 Or .Busy
  15.                 DoEvents
  16.             Loop
  17.             
  18.             For Each x In .document.getElementsBytagname("input")
  19.                 If x.Value = "¬d¸ß" Then x.Click: Exit For
  20.             Next
  21.             
  22.             .document.body.innerHTML = .document.getElementsBytagname("table")(xi).outerHTML
  23.             .execwb 17, 2       '  Select All
  24.             .execwb 12, 2       '  Copy selection
  25.             
  26.             With shts
  27.                 .Range("A" & .[A65535].End(xlUp).Row + 1).Select
  28.                 .PasteSpecial Format:="HTML"
  29.             End With
  30.         Next xi
  31.         shts.Cells.EntireColumn.AutoFit     '  ¦Û°Ê½Õ¾ãÄæ¼e
  32.         
  33.         .Quit
  34.     End With
  35. End Sub
½Æ»s¥N½X

§@ªÌ: ML089    ®É¶¡: 2013-11-20 21:15

¦^´_ 51# c_c_lai

ÂI¶i¥h¤~¤§§O¦³¬}¤Ñ

·PÁÂ! ¹Ï¸Ñ»¡©ú§@ªº¯u¥Î¤ß
§@ªÌ: GBKEE    ®É¶¡: 2013-11-21 15:41

¦^´_ 45# joey0415
  1. Busy = True            
  2. Busy = False

  3. READYSTATE_UNINITIALIZED = 0
  4. READYSTATE_LOADING = 1
  5. READYSTATE_LOADED = 2
  6. READYSTATE_INTERACTIVE = 3
  7. READYSTATE_COMPLETE = 4
½Æ»s¥N½X
¤£·Q¦ACREAT¥t¤@­ÓIE : 52# c_c_lai ¤w¼g¥X¤F
¦^´_ 52# c_c_lai
¦b2003¦³¿ù»~­×¥¿¦p¤U
  1. Option Explicit
  2. Sub ¹d¨Éºô()
  3.     Dim URL As String, shts As Worksheet
  4.     Dim x As Variant, xi As Integer, A As Object, xlHtm
  5.     Set shts = ActiveSheet '  '("¤u§@ªí2")
  6.     shts.Cells.Clear
  7.     URL = "http://www.cnyes.com/twstock/Institutional/1101.htm"
  8.     With CreateObject("InternetExplorer.Application")
  9.         .Visible = True     '  ¬O§_Åã¥Ü IE
  10.         .Navigate URL
  11.          Do While .ReadyState <> 4 Or .Busy
  12.                 DoEvents
  13.             Loop
  14.         For Each x In .Document.getElementsBytagname("input")
  15.             If x.Value = "¬d¸ß" Then x.Click: Exit For
  16.         Next
  17.         Do While .ReadyState <> 4 Or .Busy: DoEvents: Loop
  18.         xlHtm = .Document.body.innerHTML                'Àx¦s
  19.         Set A = .Document.getElementsBytagname("table")
  20.         For xi = 1 To 6
  21.             .Document.body.innerHTML = A(xi).outerHTML
  22.             .ExecWB 17, 2       '  Select All
  23.             .ExecWB 12, 2       '  Copy selection
  24.             With shts
  25.                 .Range("A" & .[A65535].End(xlUp).Row + 1).Select
  26.                 .PasteSpecial Format:="HTML"
  27.             End With
  28.             .Document.body.innerHTML = xlHtm                  'ÁÙ­ì
  29.         Next xi
  30.         shts.Cells.EntireColumn.AutoFit     '  ¦Û°Ê½Õ¾ãÄæ¼e
  31.         .Quit
  32.     End With
  33. End Sub
½Æ»s¥N½X

§@ªÌ: c_c_lai    ®É¶¡: 2013-11-21 17:31

¦^´_ 54# GBKEE
­ì¥»§Ú¥ç¬O¦p±z©Ò¼gªº (For ~ Next) ¤è¦¡³B­ù¡A¦ý¥¦¦b 2010 ª©¤j¬ù¦b²Ä¤G°j°é«K·|¥X²{
¿ù»~°T®§¡A©Ò¥H¥u¯à±N For ©¹¤WÂ\©ñ¡A¨C¦¸³£¦A°õ¦æ Click ªº°Ê§@¡A¤@¤Á«K¶¶¤ß¤F¡C
¬Ý¼Ë¤l´N¹³²Î­p¹Ïªíø»s¦³¨Ç»yªk³B²z¤§¾A¥Î°ÝÃD¤@¼Ë¡A¥u¯à¨Ìª©¥»¨£¾÷¦æ¨Æ¡A
ÁÂÁ±z¡I
§@ªÌ: GBKEE    ®É¶¡: 2013-11-21 18:04

¦^´_ 55# c_c_lai
§Ú 54# ­×¥¿ªºµ{¦¡½X2010¤£¥i¥Î?
2010½Ð¸Õ¸Õ¬Ý³oµ{¦¡½X
  1. Option Explicit
  2. Sub ¹d¨Éºô()
  3.     Dim URL As String, shts As Worksheet, ie As Object
  4.     Dim x As Variant, A As Object
  5.     Set ie = CreateObject("InternetExplorer.Application")
  6.     ie.Navigate "about:Tabs"
  7.     ie.Visible = True
  8.     Set shts = ActiveSheet '  '("¤u§@ªí2")
  9.     shts.Cells.Clear
  10.     URL = "http://www.cnyes.com/twstock/Institutional/1101.htm"
  11.     With CreateObject("InternetExplorer.Application")
  12.         .Visible = True     '  ¬O§_Åã¥Ü IE
  13.         .Navigate URL
  14.         Do While .ReadyState <> 4 Or .Busy: DoEvents: Loop
  15.         For Each x In .Document.getElementsBytagname("input")
  16.             If x.Value = "¬d¸ß" Then x.Click: Exit For
  17.         Next
  18.         Do While .ReadyState <> 4 Or .Busy: DoEvents: Loop
  19.         Set A = .Document.getElementsBytagname("table")
  20.         For x = 1 To 6
  21.             With ie
  22.             .Document.body.innerHTML = A(x).outerHTML
  23.             .ExecWB 17, 2       '  Select All
  24.             .ExecWB 12, 2       '  Copy selection
  25.             End With
  26.             With shts
  27.                 .Range("A" & .[A65535].End(xlUp).Row + 1).Select
  28.                 .PasteSpecial Format:="HTML"
  29.             End With
  30.         Next
  31.         shts.Cells.EntireColumn.AutoFit     '  ¦Û°Ê½Õ¾ãÄæ¼e
  32.         .Quit
  33.     End With
  34.     ie.Quit
  35. End Sub
½Æ»s¥N½X

§@ªÌ: c_c_lai    ®É¶¡: 2013-11-21 19:51

¦^´_ 56# GBKEE
¥u¦³¤@¥y¸Ü¯à§Î®e    ----    Perfect!
[attach]16821[/attach]
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-21 20:04

¦^´_ 56# GBKEE
¦pªG§â Set ie ¥H¤Î ie.Quit §ï¦¨µùÄÀ¡A«h·|µo¥Í¦p¹Ï¤§¿ù»~¡G
[attach]16822[/attach]
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-21 20:24

¦^´_ 56# GBKEE
ªþ¤W 54# ªºµ{¦¡°õ¦æµ²ªG¡G
[attach]16823[/attach]
§@ªÌ: GBKEE    ®É¶¡: 2013-11-21 21:01

¦^´_ 58# c_c_lai
¦pªG§â Set ie ¥H¤Î ie.Quit §ï¦¨µùÄÀ¡A«h·|µo¥Í¦p¹Ï¤§¿ù»~¡G ¿ù»~¦æ¬O­þ¤@¦æ?
µùÄÀ«áieÅܼƴN¨S¦³«ü©wª«¥ó,¦A¨Ï¥Î¨ìie·íµM·|¿ù»~.
¦^´_ 59# c_c_lai
¹Ï¤¤ »P54# ªºµ{¦¡½X¦³ÂI¤£¼Ë,©ú¤Ñ¦A¬Ý¬Ý
§@ªÌ: wufonna    ®É¶¡: 2013-11-21 23:31

¦^´_ 56# GBKEE


    ½Ð°Ý GBKEE  ª©¥D
   ie.Navigate "about:Tabs"
  §@¥Î¬O¦p¦ó¡AÁÂÁÂ
§@ªÌ: GBKEE    ®É¶¡: 2013-11-22 06:35

¦^´_ 61# wufonna [/b


    [attach]16827[/attach]
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-22 06:53

¦^´_ 60# GBKEE
(¦pªG§â Set ie ¥H¤Î ie.Quit §ï¦¨µùÄÀ)
ªþ¤W´ú¸Õ¥Îµ{¦¡½X¡G
  1. Sub ¹d¨Éºô2()
  2.     Dim URL As String, shts As Worksheet, ie As Object
  3.     Dim x As Variant, A As Object
  4.    
  5.     '  Set ie = CreateObject("InternetExplorer.Application")
  6.     '  ie.Navigate "about:Tabs"
  7.     '  ie.Visible = True
  8.    
  9.     Set shts = ActiveSheet    '  Sheets("¤u§@ªí2")
  10.     shts.Cells.Clear
  11.    
  12.     URL = "http://www.cnyes.com/twstock/Institutional/1101.htm"
  13.     With CreateObject("InternetExplorer.Application")
  14.         .Visible = True     '  ¬O§_Åã¥Ü IE
  15.         .Navigate URL
  16.         
  17.         Do While .ReadyState <> 4 Or .Busy: DoEvents: Loop
  18.         
  19.         For Each x In .Document.getElementsBytagname("input")
  20.             If x.Value = "¬d¸ß" Then x.Click: Exit For
  21.         Next
  22.         
  23.         Do While .ReadyState <> 4 Or .Busy: DoEvents: Loop
  24.         
  25.         Set A = .Document.getElementsBytagname("table")
  26.         For x = 1 To 6
  27.             '  With ie
  28.                 .Document.body.innerHTML = A(x).outerHTML
  29.                 .ExecWB 17, 2       '  Select All
  30.                 .ExecWB 12, 2       '  Copy selection
  31.             '  End With
  32.             
  33.             With shts
  34.                 .Range("A" & .[A65535].End(xlUp).Row + 1).Select
  35.                 .PasteSpecial Format:="HTML"
  36.             End With
  37.         Next
  38.         
  39.         shts.Cells.EntireColumn.AutoFit     '  ¦Û°Ê½Õ¾ãÄæ¼e
  40.         .Quit
  41.     End With
  42.    
  43.     '  ie.Quit
  44. End Sub
½Æ»s¥N½X
[attach]16828[/attach]
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-22 06:56

¦^´_ 60# GBKEE
§Ú­ì¥»ªº´ú¸Õµ{¦¡½X¡G
  1. Sub ¹d¨Éºô3()
  2.     Dim URL As String, shts As Worksheet
  3.     Dim x As Variant, xi As Integer
  4.    
  5.     Set shts = ActiveSheet        '  Sheets("¤u§@ªí2")
  6.     URL = "http://www.cnyes.com/twstock/Institutional/1101.htm"
  7.    
  8.     With CreateObject("InternetExplorer.Application")
  9.         .Visible = True     '  ¬O§_Åã¥Ü IE
  10.         .Navigate URL
  11.         
  12.         Do While .ReadyState <> 4 Or .Busy
  13.             DoEvents
  14.         Loop
  15.             
  16.         For Each x In .Document.getElementsBytagname("input")
  17.             If x.Value = "¬d¸ß" Then x.Click: Exit For
  18.         Next
  19.             
  20.         shts.Cells.Clear
  21.         For xi = 1 To 6
  22.             '  .document.body.innerHTML = .document.getElementsBytagname("table")(1).outerHTML
  23.             .Document.body.innerHTML = .Document.getElementsBytagname("table")(xi).outerHTML
  24.             .ExecWB 17, 2       '  Select All
  25.             .ExecWB 12, 2       '  Copy selection
  26.             
  27.             With shts
  28.                 '  .Cells.Clear
  29.                 .Range("A" & .[A65535].End(xlUp).Row + 1).Select
  30.                 .PasteSpecial Format:="HTML"
  31.                 '  .Cells.EntireColumn.AutoFit     '  ¦Û°Ê½Õ¾ãÄæ¼e
  32.             End With
  33.         Next xi
  34.         shts.Cells.EntireColumn.AutoFit     '  ¦Û°Ê½Õ¾ãÄæ¼e
  35.         
  36.         .Quit
  37.     End With
  38. End Sub
½Æ»s¥N½X
[attach]16829[/attach]
§@ªÌ: GBKEE    ®É¶¡: 2013-11-22 07:15

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-11-22 07:16 ½s¿è

¦^´_ 64# c_c_lai
¦b2003¤]¬O¦³³o¿ù»~,¸gÀx¦s¤º®e¦AÁÙ­ì,´N¨S¦³³o¿ù»~.
  1.     Do While .ReadyState <> 4 Or .Busy: DoEvents: Loop
  2.         xlHtm = .Document.body.innerHTML                'Àx¦s
  3.         Set A = .Document.getElementsBytagname("table")
  4.         For xi = 1 To 6
  5.             .Document.body.innerHTML = A(xi).outerHTML
  6.             .ExecWB 17, 2       '  Select All
  7.             .ExecWB 12, 2       '  Copy selection
  8.             With shts
  9.                 .Range("A" & .[A65535].End(xlUp).Row + 1).Select
  10.                 .PasteSpecial Format:="HTML"
  11.             End With
  12.             .Document.body.innerHTML = xlHtm                  'ÁÙ­ì
  13.         Next xi
½Æ»s¥N½X
¤§«á¦b¬°¤F¤£Àx¦s¦AÁÙ­ì. ¤~¦³56#ªºµ{¦¡½X¦bªÅ¥Õºô­¶©ñ¸m "table"ªº¼gªk
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-22 07:24

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2013-11-22 07:36 ½s¿è

¦^´_ 60# GBKEE
(¹Ï¤¤ »P54# ªºµ{¦¡½X¦³ÂI¤£¼Ë)
ªþ¤W°õ¦æ¤§µ{¦¡½X¡G
  1. Sub ¹d¨Éºô4()
  2.     Dim URL As String, shts As Worksheet
  3.     Dim x As Variant, xi As Integer, A As Object, xlHtm
  4.     Set shts = ActiveSheet '  '("¤u§@ªí2")
  5.     shts.Cells.Clear
  6.     URL = "http://www.cnyes.com/twstock/Institutional/1101.htm"
  7.     With CreateObject("InternetExplorer.Application")
  8.         .Visible = True     '  ¬O§_Åã¥Ü IE
  9.         .Navigate URL
  10.          Do While .ReadyState <> 4 Or .Busy
  11.                 DoEvents
  12.             Loop
  13.         For Each x In .Document.getElementsBytagname("input")
  14.             If x.Value = "¬d¸ß" Then x.Click: Exit For
  15.         Next
  16.         Do While .ReadyState <> 4 Or .Busy: DoEvents: Loop
  17.         xlHtm = .Document.body.innerHTML                'Àx¦s
  18.         Set A = .Document.getElementsBytagname("table")
  19.         For xi = 1 To 6
  20.             .Document.body.innerHTML = A(xi).outerHTML
  21.             .ExecWB 17, 2       '  Select All
  22.             .ExecWB 12, 2       '  Copy selection
  23.             With shts
  24.                 .Range("A" & .[A65535].End(xlUp).Row + 1).Select
  25.                 .PasteSpecial Format:="HTML"
  26.             End With
  27.             .Document.body.innerHTML = xlHtm                  'ÁÙ­ì
  28.         Next xi
  29.         shts.Cells.EntireColumn.AutoFit     '  ¦Û°Ê½Õ¾ãÄæ¼e
  30.         .Quit
  31.     End With
  32. End Sub
½Æ»s¥N½X
[attach]16831[/attach]
P.S.     ³o¬O­è¤~¤~°õ¦æ¥X¨Óªº¨MªG¡C
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-22 07:34

¦^´_ 65# GBKEE
(56#ªºµ{¦¡½X¦bªÅ¥Õºô­¶©ñ¸m "table"ªº¼gªk)
§Ú±N "ªÅ¥Õºô­¶" ÁôÂð_¨Óµøı¤W²M²n¦h¤F¡C
  1.     Set ie = CreateObject("InternetExplorer.Application")
  2.     ie.Navigate "about:Tabs"
  3.     '  ie.Visible = True
½Æ»s¥N½X
°õ¦æ¨MªG¤@¤Á OK¡C
§@ªÌ: GBKEE    ®É¶¡: 2013-11-22 07:42

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-11-22 07:44 ½s¿è

¦^´_ 67# c_c_lai
66# »¡ªº¿ù»~,2003¨S¦³µo¥Í.
2­Óie³£¥i¥H¤£Åã¥Ü,¨º§ó²M²nªº.
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-22 07:48

¦^´_ 68# GBKEE
»¡ªº¤]¬O¡I
ÁÂÁ«ü¾É¡C
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-22 08:03

¦^´_ 68# GBKEE
¨Æ«á·Q·Q¡Aµoı§Q¥Î "ªÅ¥Õºô­¶" ¨Ó°µ¬°Á{®É¾Ô³õ  (¶i¦æ½Æ»s¤u§@)¡A
³o­Ó Idea ÆZ¦nªº¡A¥ç¤£·|¯}Ãa­ì¥»ºô­¶ªº Table ¤º®e¡C
  1.         Set A = .Document.getElementsBytagname("table")
  2.         For x = 1 To 6
  3.             With ie
  4.                 .Document.body.innerHTML = A(x).outerHTML
  5.                 .ExecWB 17, 2       '  Select All
  6.                 .ExecWB 12, 2       '  Copy selection
  7.             End With
  8.             
  9.             With shts
  10.                 .Range("A" & .[A65535].End(xlUp).Row + 1).Select
  11.                 .PasteSpecial Format:="HTML"
  12.             End With
  13.         Next
½Æ»s¥N½X

§@ªÌ: c_c_lai    ®É¶¡: 2013-11-22 08:17

¦^´_ 68# GBKEE
«¢«¢¡I
¤Ó²M²n¤F¤]¤£¦æ¡I (¥u¯à²Ä¤@­Ó "ªÅ¥Õºô­¶")
[attach]16833[/attach]
§@ªÌ: GBKEE    ®É¶¡: 2013-11-22 08:33

¦^´_ 71# c_c_lai
2­ÓIE³£¤£Åã¥Ü,2003¦A¶]¤@¦¸,OK!
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-22 08:44

¦^´_ 72# GBKEE
©Ò¥H»¡¹À¡A³o´N¬O§Ú¤§©Ò¥H¨ØªA Micrsoft ªº¦a¤è¡I
¤£±o¤£ªA®ð¡C
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-22 09:01

¦^´_ 72# GBKEE
¤£«H¨¸¦A¸Õ¤@¦¸ (Marked «á¥ýÀx¦s¤@¦¸¡A¦A¦æ°õ¦æ)¡C
¨Æ«á¥u¥X²{¹L¤@¦¸"Åv­­°ÝÃD"«á¡A¤@¤Á¤SÂk©ó¥­ÀR (¥¿±`¤F)¡C
³o«K¬O§Ú¨ØªA Microsoft ªº½t¬G¡C
§@ªÌ: c_c_lai    ®É¶¡: 2013-11-22 09:04

¦^´_ 72# GBKEE
  1.     Set ie = CreateObject("InternetExplorer.Application")
  2.     ie.Navigate "about:Tabs"
  3.     '  ie.Visible = True
  4.    
  5.     Set shts = ActiveSheet    '  Sheets("¤u§@ªí2")
  6.     shts.Cells.Clear
  7.    
  8.     URL = "http://www.cnyes.com/twstock/Institutional/1101.htm"
  9.     With CreateObject("InternetExplorer.Application")
  10.         '  .Visible = True     '  ¬O§_Åã¥Ü IE
  11.         .Navigate URL
  12.         
½Æ»s¥N½X

§@ªÌ: gable    ®É¶¡: 2013-12-7 02:16

·s¤â ­è¥[¤J ¾Ç²ß¤F
ÁÂÁ¤j¤j­Ì ^^
§@ªÌ: ¬¡¤O¥R¨K    ®É¶¡: 2014-1-21 21:02

¿n¤ÀÁÙ¤£°÷><"
¥i¤U¸ü"¬d§ä¼ÐÅÒ.zip" ªº¤j¤j,¥i§_¶Çµ¹¤p§Ì!

E-mail: [email protected]
·P¿E¤£·q~




Åwªï¥úÁ{ ³Â»¶®a±Ú°Q½×ª©ª© (http://forum.twbts.com/)