- ©«¤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
        
|
RE: ºô¸ôCSV¤U¸ü°ÝÃD
¦^´_ 1# spermbank
³oì©lÀɮפ¤§ä¤£¨ìCSVÀɮתººô§}¥i¤U¸ü!!
¸Õ¸Õ¬Ý (¥i¸ÕµÛ×§ï¤U¸ü¤W¥«,¤WÂdªº¸ê®Æ)- Option Explicit
- Sub ¤½¶}¸ê°TÆ[´ú¯¸()
- Dim Ie As Object, xx, k, j, i, AA As Variant
- Dim T As Date
- ActiveSheet.Cells.Clear
- Application.DisplayStatusBar = True
- On Error GoTo ie_err
- Set Ie = CreateObject("InternetExplorer.Application")
- Ie.Navigate "http://mops.twse.com.tw/mops/web/t51sb08"
- Ie.Visible = True
- Do While Ie.Busy Or Ie.ReadyState <> 4: DoEvents: Loop
- '********** ×§ï³o¸Ì ªº¿ï¶µ
- Ie.Document.ALL(632).Value = "sii" '¤W¥« = sii,¤WÂd = otc,¿³Âd = rotc,¤½¶}µo¦æ = pub
- Ie.Document.ALL(643).Value = "101" '¦~«×
- Ie.Document.ALL(650).Value = "04" '²Ä¤@©u = 01,²Ä¤G©u = 02,²Ä¤T©u = 03,²Ä¥|©u = 04
- Ie.Document.ALL(667).Click
-
- Ie.Visible = False
- ºô¶¾ã²z
- Set AA = Ie.Document.getelementsbytagname("table") '¸ê®Æ°Ï
- ' Ie.Quit
- T = Time
- Application.ScreenUpdating = False
- With ActiveSheet
- On Error Resume Next
- For xx = 13 To AA.Length - 1
- For i = 0 To AA(xx).Rows.Length - 1 '¼g¤J¸ê®Æ
- k = k + 1
- For j = 0 To 19
- .Cells(k, 1).Select
- Application.StatusBar = "¤U¸ü¸ê®Æ¤¤ ..." & k - 1
- .Cells(k, j + 1) = AA(xx).Rows(i).Cells(j).innertext
- Next
- Next
- Next
- Set AA = .Range("S2:S" & .[S2].End(xlDown).Row)
- AA.Replace "°ò¥»¨CªÑ¬Õ¾l", "", xlWhole
- AA.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
- .Cells(.Rows.Count, 1).End(xlUp).EntireRow.Delete
- ActiveWindow.ScrollRow = .Cells(.Rows.Count, 1).End(xlUp).Row - 20
- .Cells(.Rows.Count, 1).End(xlUp).Select
- End With
- Application.ScreenUpdating = True
- 'Ie.Quit
- Application.StatusBar = "¤U¸ü¸ê®Æ®É¶¡ : " & Format(Time - T, ["S¬í"])
- End
- ie_err:
- MsgBox "ºô¶¦³°ÝÃD,½Ð«·s°õ¦æ..."
- Set Ie = Nothing
- End Sub
- Private Sub ºô¶¾ã²z() 'µ¥«Ýºô¶¤U¸ü¸ê®Æ§¹²¦ªº®É¶¡
- Dim Tt(1 To 3) As Date
- Tt(1) = Time
- Tt(2) = Time
- Tt(3) = #12:00:10 AM# '10¬í ½Õ¾ã³o¸Ì
- Do
- If Time > Tt(2) Then
- Application.StatusBar = "ºô¶¤U¸ü¤¤ ³Ñ¾l¬í¼Æ.. " & Second(Tt(1) + Tt(3) - Time)
- Tt(2) = Time
- End If
- DoEvents
- Loop Until Time > Tt(1) + Tt(3)
- Application.StatusBar = "¸ê®Æ¤U¸ü¤¤...."
- End Sub
½Æ»s¥N½X |
|