- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¦^´_ 1# shuasa
¸Õ¸Õ¬Ý- Option Explicit
- Private Sub Worksheet_Change(ByVal Target As Range)
- Application.EnableEvents = False
- If Target.Address = "$B$1" Then 'B1Åܧó´N°õ¦æ (§ó·s¸ê®Æ)
- Ex_¤WÂdӪѦ¨¥æ¸ê Target
- End If
- Application.EnableEvents = True
- End Sub
- Sub Ex_¤WÂdӪѦ¨¥æ¸ê(nCode)
- Dim E As Object, R As Integer, C As Integer, St As String, Rng As Range
- With CreateObject("InternetExplorer.Application")
- .Visible = True
- .Top = 1: .Left = 1: .Width = 1: .Height = 1
- .Navigate "http://www.tpex.org.tw/web/stock/statistics/monthly/st42.php?l=zh-tw"
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- With .Document.all("input_stock_code")
- .Value = nCode
- .Focus
- Application.SendKeys "~" '«ö¤UEenterÁä
- End With
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- Do While .Document.all.tags("table") Is Nothing: DoEvents: Loop
- Do While .Document.all.tags("table").Length < 4:
- Set E = .Document.all.tags("table")(0)
- If InStr(E.innertext, "¬dµL¸Óµ§¸ê®Æ,½Ð«·s¬d¸ß!!") Then St = nCode & vbLf & E.innertext: GoTo bby
- If InStr(E.innertext, "±z¿é¤JªºªÑ²¼¥N½X¦³»~¡A½ÐÀˬd!!") Then St = nCode & vbLf & "ªºªÑ²¼¥N½X¦³»~¡A½ÐÀˬd": GoTo bby
- DoEvents
- Loop
- Set E = .Document.all.tags("table")(2)
- Set Rng = Range("b3")
- With Rng
- .CurrentRegion.Clear
- For R = 0 To E.Rows.Length - 1
- For C = 0 To E.Rows(R).Cells.Length - 1
- .Cells(R + 1, C + 1) = E.Rows(R).Cells(C).innertext
- Next
- Next
- End With
- Rng = .Document.all.tags("table")(0).Rows(0).Cells(1).innertext
- bby:
- .Quit 'Ãö³¬ºô¶
- End With
- If St <> "" Then MsgBox vbTab & St: Range("b3").CurrentRegion.Clear
- End Sub
½Æ»s¥N½X |
|