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

[µo°Ý] VBA±±¨îIE¿é¤J­È

¦^´_ 2# kim223824
  'URL = "http://amis.afa.gov.tw/v-htm/v102.htm"
    '********ºô§}¦³§ïÅÜ ******
    URL = "http://amis.afa.gov.tw/v-asp/v102q.asp"



¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub µæ»ù2015_12_05_1()
  3.     Dim xTable As Object, k As Integer, c As Integer, r As Integer
  4.     'URL = "http://amis.afa.gov.tw/v-htm/v102.htm"
  5.     '********ºô§}¦³§ïÅÜ ******
  6.     URL = "http://amis.afa.gov.tw/v-asp/v102q.asp"
  7.    
  8.     With CreateObject("InternetExplorer.application")
  9.         .Visible = True
  10.         .Navigate URL
  11.         Do While .Busy Or .readyState <> 4: DoEvents: Loop
  12.         With .document
  13.             .ALL("mkno").Value = 104
  14.             .ALL("B1").Click
  15.         End With
  16.         Do While .Busy Or .readyState <> 4: DoEvents: Loop
  17.         Set xTable = .document.getelementsbytagname("TABLE") '(1)
  18.         With Sheets("¤U¸ü")
  19.             .UsedRange.Clear
  20.             k = 1
  21.             For i = 0 To 1 ' For EACH  E In xTable  '.document.getelementsbytagname("TABLE")
  22.                 For r = 0 To xTable(i).Rows.Length - 1
  23.                     For c = 0 To xTable(i).Rows(r).Cells.Length - 1
  24.                         .Cells(k + r, c + IIf(i = 0, 1 + 1 * c, 1)) = xTable(i).Rows(r).Cells(c).innerText
  25.                     Next
  26.                 Next
  27.                 k = k + xTable(i).Rows.Length
  28.             Next
  29.         End With
  30.         .Quit
  31.     End With
  32. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 4# kim223824
  1.   Set xTable = .document.getelementsbytagname("TABLE") '(1)
  2.         Stop  'µ{¦¡¼È°±
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : µêªÅ¦³ºÉ¡D§ÚÄ@µL½a¡AµoÄ@®e©ö¦æÄ@Ãø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD