ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ½Ð°Ý¦¹µ{¦¡¦bie8 ¤U¥i°õ¦æ¡A§ó·s¦Üie11´N¤£¯à°õ¦æ¡AÁÂÁÂ

[µo°Ý] ½Ð°Ý¦¹µ{¦¡¦bie8 ¤U¥i°õ¦æ¡A§ó·s¦Üie11´N¤£¯à°õ¦æ¡AÁÂÁÂ

  1. Option Explicit
  2. Dim ie As Object   '¼Ò²Õ³Ì³»ºÝ Dim ¨Ñ³o¼Ò²Õªºµ{§Ç¨Ï¥ÎªºÅܼÆ
  3. Sub AllFile()
  4.     Dim i As Integer, v, Y As Integer, S As String
  5.     Dim z As Integer
  6.     Set ie = CreateObject("internetexplorer.application")   '¨Ï¥Î¦¹¤è¦¡¥i¥H§K°£ "³]©w¤Þ¥Î¶µ¥Ø"
  7.     With ie 'ÁY¤pIEµøµ¡
  8.         .Visible = True
  9.         .Width = 5
  10.         .Height = 5
  11.     End With
  12.     With ¤u§@ªí1
  13.         Dim AR
  14.            AR = .Range("C1:J1")
  15.           .Range("C:J") = ""
  16.           .Range("C1:J1") = AR
  17.           z = 0
  18.         For i = 2 To .Range("A" & .Rows.Count).End(xlUp).Row
  19.      
  20.            v = .Cells(i, 1).Value
  21.             GetDividend (v)
  22.              .Cells(i, 3).Resize(1, 7).Value = ¤u§@ªí2.Cells(7, 1).Resize(1, 7).Value

  23.              If ¤u§@ªí2.Cells(7, 5).Value > 0 Then
  24.                .Cells(i, 10).Value = 1
  25.                z = z + 1
  26.               Else
  27.                .Cells(i, 10).Value = 0
  28.               End If
  29.                             If ¤u§@ªí2.Cells(7, 5).Value > 0 And ¤u§@ªí2.Cells(8, 5).Value > 0 And ¤u§@ªí2.Cells(9, 5).Value > 0 Then 'K(À禬³s3­Ó¤ë¥¿¦¨ªø)
  30.                 .Cells(i, 11).Value = 1
  31.               Else
  32.                 .Cells(i, 11).Value = 0
  33.               End If
  34.         Next
  35. '            MsgBox "¦@¦³" & z & "®a¥¿¦¨ªø"
  36. .Cells(1, 10).Value = "¥h¦~¦P´Á¦~¼W²v" & Split(Date, "/")(1) - 1 & "¤ë¥÷" & .Range("A" & .Rows.Count).End(xlUp).Row & "®a¦@¦³" & z & "®a¥¿¦¨ªø"
  37.    
  38.     End With
  39.     With ie  'IEµøµ¡³Ì¤j¤Æ
  40.         Application.WindowState = xlMaximized
  41.         .Height = Application.Height
  42.         .Width = Application.Width
  43.         .Quit
  44.     End With
  45. End Sub

  46. Public Function MyFile(v As Integer, i As Integer)
  47.   '   Dim i As Integer, v, Y As Integer, S As String
  48.     Set ie = CreateObject("internetexplorer.application")   '¨Ï¥Î¦¹¤è¦¡¥i¥H§K°£ "³]©w¤Þ¥Î¶µ¥Ø"
  49.     With ie 'ÁY¤pIEµøµ¡
  50.         .Visible = True
  51.         .Width = 5
  52.         .Height = 5
  53.     End With
  54.     With ¤u§@ªí1
  55.            .Range("C" & v & ":J" & v) = ""
  56. '        .Range("E2").CurrentRegion = ""            '²M°£¤u§@ªí1,¦~«×½d³ò
  57.            v = .Cells(i, 1).Value
  58.             GetDividend (v)
  59.              .Cells(i, 3).Resize(1, 7).Value = ¤u§@ªí2.Cells(7, 1).Resize(1, 7).Value

  60.              If ¤u§@ªí2.Cells(7, 5).Value > 0 Then
  61.                .Cells(i, 10).Value = 1
  62. '               z = z + 1
  63.               Else
  64.                .Cells(i, 10).Value = 0
  65.               End If
  66.               If ¤u§@ªí2.Cells(7, 5).Value > 0 And ¤u§@ªí2.Cells(8, 5).Value > 0 And ¤u§@ªí2.Cells(9, 5).Value > 0 Then 'k (À禬³s3­Ó¤ë¥¿¦¨ªø)
  67.                 .Cells(i, 11).Value = 1
  68.               Else
  69.                 .Cells(i, 11).Value = 0
  70.               End If
  71.               
  72.     End With
  73.     With ie  'IEµøµ¡³Ì¤j¤Æ¡B
  74.         Application.WindowState = xlMaximized
  75.         .Height = Application.Height
  76.         .Width = Application.Width
  77.         .Quit
  78.     End With
  79. End Function

  80. Private Sub GetDividend(ByVal ss As String)     '¨úªÑ§Qºô­¶

  81.     Dim rr As String, T As Date, i, ii, k, j, S As Object
  82.     'On Error Resume Next 'µ{¦¡ªº°õ¦æ¨S¦³¹w´Áªº¿ù»~,¦¹¦æ¥i¤£¥Î.
  83.     T = Time
  84. '    rr = "http://dj.mybank.com.tw/z/zc/zch/zch_" & ss & ".asp.htm"
  85.     'rr = "http://www.emega.com.tw/z/zc/zch/zch_" & ss & ".ASP.HTM"
  86. rr = "http://pscnetinvest.moneydj.com.tw/z/zc/zch/zch_" & ss & ".djhtm"
  87.     With ie
  88.         .Navigate rr
  89.         Do While .readyState <> 4                          'µ¥«Ýºô­¶¤U¸ü§¹²¦
  90.               DoEvents
  91.               If Time >= T + #12:00:03 AM# Then            'µ¥«Ý3¬í
  92.                 DoEvents
  93.                 Application.SendKeys "~"                    'ªÑ²¼¥N¸¹¿ù»~,ºô­¶·|¦³°T®§,¶·«ö½T©w,¤~¥iÄ~Äò¤U­±ªÑ²¼¥N¸¹
  94.                
  95.                 Exit Do
  96.               End If
  97.         Loop
  98.         ''***¤£¬Oµ¥«Ý8¬í 3¬í¤Ó¤Ö·|»~¿ù§ï8§® ***
  99.         Do
  100.         Set S = .Document.getElementsByTagName("table")(2) ' ·sªº table 4
  101.         Loop Until Not S Is Nothing
  102.         '*** ³Ó¤@ ¨S®»¨ì ????
  103.         '*** ¦]µ{¦¡¹B¦æ¤Ó§Ö , S Is Nothing, S ©|¥¼«ü©w¬°.Document.getElementsByTagName("table")(4)
  104.         '*** µ{¦¡¤w¸g°õ¦æ¤U¤@¦æ, With ¤u§@ªí2 ªºµ{¦¡½X

  105.         With ¤u§@ªí2
  106.             .UsedRange.Clear
  107.             For i = 0 To S.Rows.Length - 1      '¼g¤J¸ê®Æ
  108.                 k = k + 1
  109.                    '¥Î On Error Resume Next ¨Ïµ{¦¡Ä~Äò°õ¦æ
  110.                     For ii = 0 To S.Rows(i).Cells.Length - 1  ' S.Rows(i).Cells.Length - 1 ¤~¬O¥¿½T
  111.                     .Cells(k, ii + 1) = S.Rows(i).Cells(ii).innerText
  112.                     DoEvents
  113.                     Next
  114.             Next
  115.         End With
  116.     End With
  117. End Sub
½Æ»s¥N½X

Â^¨ú1.JPG (98.5 KB)

Â^¨ú1.JPG

Â^¨ú2.JPG (81.6 KB)

Â^¨ú2.JPG

¦^´_ 1# wufonna


    ³o¬OÀɮסAÁÂÁÂ

Annualrate2 - test»s.rar (61.52 KB)

TOP

¦^´_ 1# wufonna


    ³»¤W
¦b´ú¸Õ¼Ò¦¡¤¤´N¥i°õ¦æ¨ì§¹¡A½Ð±Ð¤j¤j¦³¹J¹L¬Û¦Pªº¶Ü¡A¦p¦ó¸Ñ¨M¡AÁÂÁÂ&#128512;

TOP

        ÀR«ä¦Û¦b : ¶¢¤HµL¼Ö½ì¡A¦£¤HµL¬O«D¡C
ªð¦^¦Cªí ¤W¤@¥DÃD