- ©«¤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
|
¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-12-28 07:24 ½s¿è
¦^´_ 3# t8899
¸Õ¸Õ¬Ý- Option Explicit
- Sub Ex_½L«á¸ê°T_¨C¤é¦¬½L¦æ±¡()
- Dim A As Object, xDate As Date, EDATE As Date
- '***********´ú¸Õ¥Î
- '§ì¨ì¦³¬°¤î(¥u§ì5¤Ñ)¡A5¤Ñ³£§ì¤£¨ì¤]´£¥Ü
- EDATE = Date + 5
- xDate = EDATE
- '*************
- 'xDate = Date '¥¿¦¡±`µ{¦¡½X
- With CreateObject("InternetExplorer.Application")
- .Visible = True
- .Navigate "http://www.twse.com.tw/ch/trading/exchange/MI_INDEX/MI_INDEX.php"
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- Ie_Refresh:
- With .Document
- .ALL("qdate").Value = Format(xDate, "E/MM/DD") '¤é´Á¥iקï
- .ALL("selectType").Value = "MS"
- .ALL("query-button").Click
- End With
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- If InStr(.Document.BODY.innerText, "¬dµL¸ê®Æ") Then
- If xDate + 4 >= EDATE Then '´ú¸Õ¥Î********
- 'If xDate + 4 >= Date Then '¥¿¦¡±`µ{¦¡½X
- Debug.Print xDate 'ÅçÃҥΠ¥i§R°£
- xDate = xDate - 1
- GoTo Ie_Refresh
- End If
- .Quit
- MsgBox Format(xDate, "E/MM/DD") & " ¬dµL¸ê®Æ"
- Exit Sub
-
- End If
- Set A = .Document.getElementsByTagName("table")
- .Document.BODY.innerHTML = A(A.Length - 1).outerHTML '¨ú³Ì«áªº¤@Ó"table"
-
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- .ExecWB 17, 2 ' Select All
- .ExecWB 12, 2 ' Copy selection
- .Quit 'Ãö³¬ºô¶
- With ActiveSheet '¥i«ü©w¤u§@ªí
- .UsedRange.Clear
- .Range("A1").Select
- .PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:=False, NOHTMLFormatting:=True
- End With
- End With
- End Sub
½Æ»s¥N½X |
|