- ©«¤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
        
|
¦^´_ 6# wufonna
¸Õ¸Õ¬Ý- Option Explicit
- Dim ie As Object '¼Ò²Õ³Ì³»ºÝ Dim ¨Ñ³o¼Ò²Õªºµ{§Ç¨Ï¥ÎªºÅܼÆ
- Sub AllFile()
- Dim i As Integer, v, Y As Integer, S As String
- S = "I" '2005 ¦~«×°_©lÄæ¦ì
- Set ie = CreateObject("internetexplorer.application") '¨Ï¥Î¦¹¤è¦¡¥i¥H§K°£ "³]©w¤Þ¥Î¶µ¥Ø"
- With ie 'ÁY¤pIEµøµ¡
- .Visible = True
- .Width = 5
- .Height = 5
- End With
- With ¤u§@ªí1
- .Range(S & 1).CurrentRegion = "" '²M°£¤u§@ªí1,¦~«×½d³ò
- Do
- .Range(S & 1).Offset(, Y) = 2005 + Y
- Y = Y + 1
- Loop While 2005 + Y < Year(Date)
- For i = 2 To .Range("A" & .Rows.Count).End(xlUp).Row
- v = .Cells(i, 1).Value
- GetDividend (v)
- .Cells(i, S).Resize(, Y) = Application.WorksheetFunction.Transpose(¤u§@ªí2.Range("H4").Resize(Y))
- If Application.Sum(.Cells(i, S).Resize(, Y)) > 1 Then
- .Cells(i, S).Offset(, Y) = 1
- Else
- .Cells(i, S).Offset(, Y) = 0
- End If
- Next
- .Range(S & 1).CurrentRegion.Replace "--", "", xlWhole
- End With
- With ie 'IEµøµ¡³Ì¤j¤Æ
- Application.WindowState = xlMaximized
- .Height = Application.Height
- .Width = Application.Width
- .Quit
- End With
- End Sub
- Private Sub GetDividend(ByVal ss As String)
- Dim rr As String, T As Date, i, ii, k, j, S
- On Error Resume Next
- T = Time
- rr = "http://yamstock.megatime.com.tw/asp/stockinfo/GetReport.asp?select_table=html\Ficxxx\&stockid=" & ss & "&name1=D4&index1=12" ' ¥¿½Tªº
- With ie
- .Navigate rr
- Do While .ReadyState <> 4 'µ¥«Ýºô¶¤U¸ü§¹²¦
- DoEvents
- If Time >= T + #12:00:03 AM# Then 'µ¥«Ý3¬í
- DoEvents
- Application.SendKeys "~" 'ªÑ²¼¥N¸¹¿ù»~,ºô¶·|¦³°T®§,¶·«ö½T©w,¤~¥iÄ~Äò¤U±ªÑ²¼¥N¸¹
- Exit Do
- End If
- Loop
- Set S = .Document.getelementsbytagname("table")(11)
- With ¤u§@ªí2
- .UsedRange.Clear
- For i = 0 To S.Rows.Length - 1 '¼g¤J¸ê®Æ
- k = k + 1
- For j = 0 To S.Rows(i).Length - 1
- For ii = 0 To S.Rows(i).Cells.Length - 1
- .Cells(k, ii + 1) = S.Rows(i).Cells(ii).innertext
- DoEvents
- Next
- Next
- Next
- End With
- End With
- End Sub
½Æ»s¥N½X |
|