- ©«¤l
- 759
- ¥DÃD
- 249
- ºëµØ
- 0
- ¿n¤À
- 1021
- ÂI¦W
- 0
- §@·~¨t²Î
- windows 11
- ³nÅ骩¥»
- OFFICE2021
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2011-5-30
- ³Ì«áµn¿ý
- 2024-11-15
|
[µo°Ý] ¥Î createDocumentFromUrl ¥N´À IE ªº¤è¦¡¤U¸üºô¶¸ê®Æ ???
http://mis.twse.com.tw/stock/gro ... ind=TIDX#STATISTICS
¦¹ºô¶ ¥i¥H¥Î createDocumentFromUrl ©Î Mshtml.HTMLDocument "¥N´ÀIE" ªº¤è¦¡¤U¸üºô¶ªº¸ê®Æ¶Ü ??
ie¤èªkªº®Ä¯à«Ü®t¡A¦]¬°¶}±Ò IE n®É¶¡¡A¤ÀªR¤å¥ó¤]n®É¶¡¡C©Ò¥H¾ãÅ骺®É¶¡©Ôªº«Üªø¡C
Option Explicit
Sub Ex_¶×¤JTable()
Dim i As Integer, S As Integer, K As Integer, J As Integer
Dim Element
With CreateObject("InternetExplorer.Application")
'.Visible = True '¥iÅã¥Üºô¶
.Navigate "http://mis.twse.com.tw/stock/group.jsp?ex=tse&ind=TIDX#STATISTICS"
Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
Set Element = .document.getelementsbytagname("table")
On Error Resume Next
With Sheets(1)
.Cells.Clear
'For s = 0 To element.Length - 1 '¤£ª¾¦¹ºô¶ªºtable¤º®e:½Ð¥ý¦æ´ú¸Õºô¶ªº§¹¾ãtable¤º®e
For S = 0 To 3 '¤w§ä¥Xºô¶ªºtable¤º®e¦b 0-3 ¤¤
For i = 0 To Element(S).Rows.Length - 1
K = K + 1
For J = 0 To 5 '¸ê®ÆªºÄæ¦ì¦@6¦ì
.Cells(K, J + 1) = Element(S).Rows(i).Cells(J).innerText
'********************************************
'¤£ª¾¦¹ºô¶ªºtable¤º®e:¥ý¦æ¦C¥X table ¦ì¸m *
'Sheets(2).Cells(k, J + 1) = s '*
'********************************************
Next
Next
Next
.Cells.EntireColumn.AutoFit '¦Û°Ê½Õ¾ãÄæ¼e
.Cells.EntireRow.AutoFit '¦Û°Ê½Õ¾ã¦C°ª
End With
.Quit
End With
Set Element = Nothing
MsgBox "0K"
End Sub |
|