½Ð°Ýquerytalbe.add¶×¤J ªÑ²¼¥N½X®æ¦¡°ÝÃD
- ©«¤l
- 38
- ¥DÃD
- 19
- ºëµØ
- 0
- ¿n¤À
- 84
- ÂI¦W
- 0
- §@·~¨t²Î
- win7
- ³nÅ骩¥»
- office 2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- taichung
- µù¥U®É¶¡
- 2011-7-6
- ³Ì«áµn¿ý
- 2022-3-29
|
½Ð°Ýquerytalbe.add¶×¤J ªÑ²¼¥N½X®æ¦¡°ÝÃD
½Ð°Ý¦U¦ì«e½ú:
querytalbe.add¶×¤JªÑ²¼¦¨¥æ»ù®É ,¥xÆW50ªÑ²¼¥N½X0050Åܦ¨50°ÝÃD
½Ð°Ýºô¶¸ê®Æ¶×¤J®É,¤@¨Ç querytable.add¨äÄݩʳ]©w¤è¦¡
ÁÂÁÂ! |
-
-
¦¨¥æ»ù.rar
(126.57 KB)
ªþ¥ó
|
|
|
|
|
|
- ©«¤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-9-21 16:51 ½s¿è
¦^´_ 1# ten999
¸Õ¸Õ¬Ý- Option Explicit
- Sub Ex()
- Dim DATE_REQ As Date, yyyymm As String, yyyymmdd As String, yyymmdd As String
- Dim URL As String, A As Object, E As String, i As Integer, ii As Integer, Sh As Worksheet, t As Date
- On Error GoTo IE_ER
- DATE_REQ = Date
- Do
- If Weekday(DATE_REQ, vbMonday) > 5 Then DATE_REQ = DATE_REQ - 1 '¨ú±oÀç·~¤é
- Loop Until Weekday(DATE_REQ, vbMonday) <= 5
- DATE_REQ = CDate(InputBox("½Ð¿é¤J¥æ©ö¤é´Á, ®æ¦¡ 2011/9/6", , DATE_REQ))
- yyyymm = Year(DATE_REQ) & Format(Month(DATE_REQ), "00")
- yyyymmdd = Year(DATE_REQ) & Format(Month(DATE_REQ), "00") & Format(Day(DATE_REQ), "00")
- yyymmdd = Year(DATE_REQ) - 1911 & "/" & Format(Month(DATE_REQ), "00") & "/" & Format(Day(DATE_REQ), "00")
- URL = "http://www.twse.com.tw/ch/trading/exchange/MI_INDEX/genpage/Report" & yyyymm & "/A112" & yyyymmdd & "ALLBUT0999_1.php?select2=ALLBUT0999&chk_date=" & yyymmdd
- Set Sh = ActiveSheet
- Sh.Cells.Clear
- Application.StatusBar = " µ¥Ôºô¶...."
- t = Time
- With CreateObject("InternetExplorer.Application")
- .Navigate URL
- ' .Visible = True
- Do While .Busy Or .ReadyState <> 4
- DoEvents
- Loop
- If .document.Title = "HTTP 404 §ä¤£¨ì" Then 'IE8 ÂsÄý¾¹
- .Quit
- GoTo IE_ER
- End If
- Do
- Set A = .document.getElementsByTAGName("TABLE")(9)
- Loop While A Is Nothing
- With Sh
- For i = 0 To A.Rows.Length - 1
- For ii = 0 To A.Rows(i).Cells.Length - 1
- '.Cells(i + 1, "a").Select
- E = Trim(A.Rows(i).Cells(ii).innerText) 'ºô¶ªº¦r¦ê
- .Cells(i + 1, ii + 1) = E ' A.Rows(i).Cells(II).innerText
- 'ºô¶ªº¦r¦êÂà¦s¨ìÀx¦s®æ,"0050"µø¬°¼Æ¦r¦Û°Ê¥h°£"00"
- If ii = 0 And Cells(i + 1, ii + 1).Text <> E Then
- .Cells(i + 1, ii + 1).NumberFormatLocal = "@" 'Àx¦s®æ®æ¦¡§ï¬°¤å¦r
- .Cells(i + 1, ii + 1) = E '«·sµ¹¤Wºô¶ªº¦r¦ê
- End If
- Application.StatusBar = Application.Text(Time - t, "[s]") & "¬í ¸ê®Æ¤U¸ü...." & .Cells(i + 1, ii + 1)
- Next
- Next
- End With
- .Quit
- End With
- Application.StatusBar = Application.Text(Time - t, "[s]") & "¬í ¸ê®Æ¤U¸ü§¹²¦"
- Exit Sub
- IE_ER: '¤é´Á¿ù»~
- MsgBox IIf(Err = 13, "¤é´Á ¨ú®ø¿é¤J", DATE_REQ & " ¤é´Á ¦³»~")
- Application.StatusBar = False
- End Sub
½Æ»s¥N½X |
|
|
|
|
|
|
- ©«¤l
- 181
- ¥DÃD
- 5
- ºëµØ
- 0
- ¿n¤À
- 197
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- 2000
- ¾\ŪÅv
- 20
- ©Ê§O
- ¤k
- µù¥U®É¶¡
- 2014-3-9
- ³Ì«áµn¿ý
- 2024-4-29
|
¥Î³o¸Õ¬Ý¬Ý .WebSelectionType = xlEntirePage |
|
|
|
|
|
|