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

[µo°Ý] ½Ð°Ý¦³¤Hª¾¹D¤WÂd­ÓªÑ¦~¦¨¥æ¸ê°T¦p¦ó¶×¤JExcel

[µo°Ý] ½Ð°Ý¦³¤Hª¾¹D¤WÂd­ÓªÑ¦~¦¨¥æ¸ê°T¦p¦ó¶×¤JExcel

½Ð°Ý¦³¤Hª¾¹D¤WÂd­ÓªÑ¦~¦¨¥æ¸ê°T¦p¦ó¶×¤JExcel
http://www.tpex.org.tw/web/stock/statistics/monthly/st42.php?l=zh-tw
¨Ò¦p§Ú­n¬d¸ß4947,«ö"¦C¦L/¶×¥XHTML" ²£¥Íªººô­¶
http://www.tpex.org.tw/web/stock/statistics/monthly/print_st42.php?l=zh-tw
¬Ý¤£¥X¹ê»Úªººô§},ªþÀÉ"µµ¦â¼ÐÅÒªº¤u§@ªí"¥¼§¹¦¨³¡¥÷......

¾ú¥vªÑ»ù.rar (89.28 KB)

shuasa

¦^´_ 1# shuasa
¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Private Sub Worksheet_Change(ByVal Target As Range)
  3.     Application.EnableEvents = False
  4.     If Target.Address = "$B$1" Then 'B1Åܧó´N°õ¦æ (§ó·s¸ê®Æ)
  5.         Ex_¤WÂd­ÓªÑ¦¨¥æ¸ê Target
  6.     End If
  7.     Application.EnableEvents = True
  8. End Sub
  9. Sub Ex_¤WÂd­ÓªÑ¦¨¥æ¸ê(nCode)
  10.     Dim E As Object, R As Integer, C As Integer, St As String, Rng As Range
  11.     With CreateObject("InternetExplorer.Application")
  12.         .Visible = True
  13.         .Top = 1: .Left = 1: .Width = 1: .Height = 1
  14.         .Navigate "http://www.tpex.org.tw/web/stock/statistics/monthly/st42.php?l=zh-tw"
  15.         Do While .Busy Or .readyState <> 4: DoEvents: Loop
  16.         With .Document.all("input_stock_code")
  17.             .Value = nCode
  18.             .Focus
  19.             Application.SendKeys "~"    '«ö¤UEenterÁä
  20.         End With
  21.         Do While .Busy Or .readyState <> 4: DoEvents: Loop
  22.         Do While .Document.all.tags("table") Is Nothing: DoEvents: Loop
  23.         Do While .Document.all.tags("table").Length < 4:
  24.             Set E = .Document.all.tags("table")(0)
  25.             If InStr(E.innertext, "¬dµL¸Óµ§¸ê®Æ,½Ð­«·s¬d¸ß!!") Then St = nCode & vbLf & E.innertext: GoTo bby
  26.             If InStr(E.innertext, "±z¿é¤JªºªÑ²¼¥N½X¦³»~¡A½ÐÀˬd!!") Then St = nCode & vbLf & "ªºªÑ²¼¥N½X¦³»~¡A½ÐÀˬd": GoTo bby
  27.             DoEvents
  28.         Loop
  29.         Set E = .Document.all.tags("table")(2)
  30.         Set Rng = Range("b3")
  31.         With Rng
  32.             .CurrentRegion.Clear
  33.             For R = 0 To E.Rows.Length - 1
  34.                 For C = 0 To E.Rows(R).Cells.Length - 1
  35.                     .Cells(R + 1, C + 1) = E.Rows(R).Cells(C).innertext
  36.                 Next
  37.             Next
  38.         End With
  39.         Rng = .Document.all.tags("table")(0).Rows(0).Cells(1).innertext
  40. bby:
  41.         .Quit        'Ãö³¬ºô­¶
  42.     End With
  43.     If St <> "" Then MsgBox vbTab & St: Range("b3").CurrentRegion.Clear
  44. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 2# GBKEE


    ·PÁÂGBKEE¤j«ü¾É,°ÝÃD¸Ñ¨M¤F,ÁÂÁ±z!
shuasa

TOP

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