- ©«¤l
- 40
- ¥DÃD
- 11
- ºëµØ
- 0
- ¿n¤À
- 100
- ÂI¦W
- 0
- §@·~¨t²Î
- Win8
- ³nÅ骩¥»
- Office2013
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- Taiwan
- µù¥U®É¶¡
- 2014-12-9
- ³Ì«áµn¿ý
- 2021-7-2
|
Option Explicit
'http://www.twse.com.tw/ch/trading/exchange/FMNPTK/FMNPTKMAIN.php
'<input name="CO_ID" type="text" size="8" value="2303">
'<input name="query-button" type="submit" class="board" value="¬d¸ß" onclick="submitForm($CO_ID)">
Sub TT()
Dim Co_Id As String, xTable As Object, Sh As Worksheet, R As Integer, C As Integer, i As Integer, ii As Integer
'Co_Id = stock_no
Co_Id = InputBox("Input Stock No")
With CreateObject("InternetExplorer.Application")
.Visible = True '**ºô¶¤£Åã¥Ü .Visible = False
.Navigate "http://www.twse.com.tw/ch/trading/exchange/FMNPTK/FMNPTKMAIN.php?&CO_ID=" & Co_Id
Do While .Busy Or .readyState <> 4: DoEvents: Loop 'µ¥Ôºô¶®_¤J§¹¾ã
.Document.ALL("query-button").Click 'ºô¶¤W«ö¤U¬d¸ßÁä
Do While .Busy Or .readyState <> 4: DoEvents: Loop 'µ¥Ôºô¶®_¤J§¹¾ã
Set xTable = .Document.ALL.TAGS("Table") '³]©wÅܼƬ°ºô¶ tagname "Table"ªºª«¥ó¶°¦X
'***³o¬qµ{¦¡½X¨Ñ´M§ä²Ä´XÓTable¬°©Ò§Anªº¸ê®Æ**
'For i = 0 To xTable.Length - 1? ?'Length ºô¶ª«¥ó¶°¦Xpºâ¤lª«¥óªº¨ç¼Æ
'MsgBox "²Ä" & i & "Ó¸ê®Æ" & vbLf & xTable(i).innertext '**¬d¬Ý§Anªº¸ê®Æ¬°²Ä´XÓTable
' Next
'************************************
Set Sh = Sheets("temp") '«ü©w¤u§@¶
Sh.UsedRange.Clear '²M°£¤u§@¶
'*******Ū¨ú¸ê®Æªºµ{¦¡½X******************
ii = 1
For i = 3 To 4
If InStr(xTable(i).innertext, "¬dµL¸ê®Æ¡I") Then MsgBox xTable(i).innertext: .Quit: Exit Sub
For R = 0 To xTable(i).Rows.Length - 1
For C = 0 To xTable(i).Rows(R).Cells.Length - 1
Sh.Cells(R + ii, C + 1) = xTable(i).Rows(R).Cells(C).innertext
Next
Next
ii = R + 2
Next
'****************************************************
With Sh
Co_Id = .[a1]
.[a1] = ""
.UsedRange.Columns.AutoFit '**AutoFit ¤èªk ±N½d³ò¤¤ªºÄæ¼e©M¦C°ª½Õ¾ã¬°³Ì¾A·íªºÈ¡C
.[a1] = Co_Id
End With
.Quit 'Ãö³¬ºô¶
End With
End Sub
°õ¦æ«á¥X²{¿ù»~¦b If InStr(xTable(i).innertext, "¬dµL¸ê®Æ¡I") Then MsgBox xTable(i).innertext: .Quit: Exit Sub
½Ð¨º»yªk¦³»~ ? ÁÂÁ |
|