- ©«¤l
- 161
- ¥DÃD
- 26
- ºëµØ
- 0
- ¿n¤À
- 187
- ÂI¦W
- 0
- §@·~¨t²Î
- xp
- ³nÅ骩¥»
- office 2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- TW
- µù¥U®É¶¡
- 2011-1-2
- ³Ì«áµn¿ý
- 2022-2-16
|
¦^´_ 16# GBKEE
½Ð±Ð G ¤j¤j
§Ú§ï¤F¤@¨Ç¸ê®Æ ¦³¨Ç¸ê®ÆÁÙ¦¬¤£¨ì
½Ð G ¤j ¬Ý¨º¸Ìn§ïªº
ÁÂÁÂ- Dim ie As Object '¼Ò²Õ³Ì³»ºÝ Dim ¨Ñ³o¼Ò²Õªºµ{§Ç¨Ï¥ÎªºÅܼÆ
- Sub AllFile()
- Dim i As Integer, v, Y As Integer, S As String
- Set ie = CreateObject("internetexplorer.application") '¨Ï¥Î¦¹¤è¦¡¥i¥H§K°£ "³]©w¤Þ¥Î¶µ¥Ø"
- With ie 'ÁY¤pIEµøµ¡
- .Visible = True
- .Width = 5
- .Height = 5
- End With
- With ¤u§@ªí1
- Dim AR
- AR = .Range("E1:G1")
- .Range("E:G") = ""
- .Range("E1:G1") = AR
- ' .Range("E2").CurrentRegion = "" '²M°£¤u§@ªí1,¦~«×½d³ò
- For i = 2 To .Range("A" & .Rows.Count).End(xlUp).Row
- v = .Cells(i, 1).Value
- GetDividend (v)
- .Cells(i, 5).Value = ¤u§@ªí2.Cells(2, 2).Value
- .Cells(i, 6).Value = ¤u§@ªí2.Cells(2, 5).Value
- GetClosePrice (v)
- .Cells(i, 7).Value = ¤u§@ªí3.Cells(2, 8).Value
-
- Next
- 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)
- Private Sub GetDividend(ByVal ss As String) '¨úªÑ§Qºô¶
- Dim rr As String, T As Date, i, ii, k, j, S As Object
- 'On Error Resume Next 'µ{¦¡ªº°õ¦æ¨S¦³¹w´Áªº¿ù»~,¦¹¦æ¥i¤£¥Î.
- T = Time
- rr = "http://dj.mybank.com.tw/z/zc/zcc/zcc_" & ss & ".asp.htm"
- With ie
- .Navigate rr
- Do While .readyState <> 4 'µ¥«Ýºô¶¤U¸ü§¹²¦
- DoEvents
- If Time >= T + #12:00:03 AM# Then 'µ¥«Ý8¬í 3¬í¤Ó¤Ö·|»~¿ù§ï8§®
- DoEvents
- Application.SendKeys "~" 'ªÑ²¼¥N¸¹¿ù»~,ºô¶·|¦³°T®§,¶·«ö½T©w,¤~¥iÄ~Äò¤U±ªÑ²¼¥N¸¹
-
- Exit Do
- End If
- Loop
- ''***¤£¬Oµ¥«Ý8¬í 3¬í¤Ó¤Ö·|»~¿ù§ï8§® ***
- Do
- Set S = .Document.getElementsByTagName("table")(3) ' ·sªº table 4
- Loop Until Not S Is Nothing
- '*** ³Ó¤@ ¨S®»¨ì ????
- '*** ¦]µ{¦¡¹B¦æ¤Ó§Ö , S Is Nothing, S ©|¥¼«ü©w¬°.Document.getElementsByTagName("table")(4)
- '*** µ{¦¡¤w¸g°õ¦æ¤U¤@¦æ, With ¤u§@ªí2 ªºµ{¦¡½X
- 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 '³o¦æ¬O¿ù»~ªº ¤]¬O¦h¾lªº°j°é
- '¥Î On Error Resume Next ¨Ïµ{¦¡Ä~Äò°õ¦æ
- For ii = 0 To S.Rows(i).Cells.Length - 1 ' S.Rows(i).Cells.Length - 1 ¤~¬O¥¿½T
- .Cells(k, ii + 1) = S.Rows(i).Cells(ii).innerText
- DoEvents
- Next
- 'Next
- Next
- End With
- End With
- End Sub
- Private Sub GetClosePrice(ByVal ss As String) ' ¨ú¦¬½L»ùºô¶
- Dim rr As String, T As Date, i, ii, k, j, S As Object
- 'On Error Resume Next 'µ{¦¡ªº°õ¦æ¨S¦³¹w´Áªº¿ù»~,¦¹¦æ¥i¤£¥Î.
- T = Time
- rr = "https://djinfo.cathaysec.com.tw/Z/ZC/ZCX/ZCXNEWCATHAYSEC.DJHTM?A=" & ss
- With ie
- .Navigate rr
- Do While .readyState <> 4 'µ¥«Ýºô¶¤U¸ü§¹²¦
- DoEvents
- If Time >= T + #12:00:03 AM# Then 'µ¥«Ý8¬í 3¬í¤Ó¤Ö·|»~¿ù§ï8§®
- DoEvents
- Application.SendKeys "~" 'ªÑ²¼¥N¸¹¿ù»~,ºô¶·|¦³°T®§,¶·«ö½T©w,¤~¥iÄ~Äò¤U±ªÑ²¼¥N¸¹
-
- Exit Do
- End If
- Loop
- ''***¤£¬Oµ¥«Ý8¬í 3¬í¤Ó¤Ö·|»~¿ù§ï8§® ***
- Do
- Set S = .Document.getElementsByTagName("table")(2) ' ·sªº table 4
- Loop Until Not S Is Nothing
- '*** ³Ó¤@ ¨S®»¨ì ????
- '*** ¦]µ{¦¡¹B¦æ¤Ó§Ö , S Is Nothing, S ©|¥¼«ü©w¬°.Document.getElementsByTagName("table")(4)
- '*** µ{¦¡¤w¸g°õ¦æ¤U¤@¦æ, With ¤u§@ªí2 ªºµ{¦¡½X
- With ¤u§@ªí3
- .UsedRange.Clear
- For i = 0 To S.Rows.Length - 1 '¼g¤J¸ê®Æ
- k = k + 1
- 'For j = 0 To S.Rows(i).Length - 1 '³o¦æ¬O¿ù»~ªº ¤]¬O¦h¾lªº°j°é
- '¥Î On Error Resume Next ¨Ïµ{¦¡Ä~Äò°õ¦æ
- For ii = 0 To S.Rows(i).Cells.Length - 1 ' S.Rows(i).Cells.Length - 1 ¤~¬O¥¿½T
- .Cells(k, ii + 1) = S.Rows(i).Cells(ii).innerText
- DoEvents
- Next
- 'Next
- Next
- End With
- End With
- End Sub
½Æ»s¥N½X
|
|