½Ð±Ðª©¤j ¤u§@ªí3¨ú·l¯qªí(¦~ªí) ¤u§@ªí4¨ú¸ê²£t¶Åªí(¦~ªí)ºô¶ table ¬°¦ó³£®»¤£¨ì¸ê®Æ¡A´ú¸Õ¤Ftable(0),table(1),table(2)³£¤£¥i¥H¡AÁÂÁÂ- 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:M1")
- .Range("E:M") = ""
- .Range("E1:M1") = AR
- ' .Range("E2").CurrentRegion = "" '²M°£¤u§@ªí1,¦~«×½d³ò
- v = "2330"
- GetDividend (v)
- GetClosePrice (v)
- GetIncome (v)
- GetBalance (v)
- GetShareholding (v)
- Debug.Print v
- 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) '¨úªÑ§Qºô¶
- Dim rr As String, T As Date, i, ii, k, j, S As Object
- T = Time
- rr = "http://pscnetinvest.moneydj.com.tw/z/zc/zcc/zcc_" & ss & ".djhtm"
- With ie
- .Navigate rr
- Do While .readyState <> 4 'µ¥«Ýºô¶¤U¸ü§¹²¦
- DoEvents
- If Time >= T + #12:00:03 AM# Then
- DoEvents
- Application.SendKeys "~" 'ªÑ²¼¥N¸¹¿ù»~,ºô¶·|¦³°T®§,¶·«ö½T©w,¤~¥iÄ~Äò¤U±ªÑ²¼¥N¸¹
-
-
- Exit Do
- End If
- Loop
- Do
- Set S = .Document.getElementsByTagName("table")(2)
- Loop Until Not S Is Nothing
- With ¤u§@ªí2
- .UsedRange.Clear
- For i = 0 To S.Rows.Length - 1 '¼g¤J¸ê®Æ
- k = k + 1
- 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
- End With
- End With
- End Sub
- Private Sub GetClosePrice(ByVal ss As String) ' ¨ú°ò¥»¸ê®Æ
- Dim rr As String, T As Date, i, ii, k, j, S As Object
- T = Time
- rr = "http://pscnetinvest.moneydj.com.tw/z/zc/zca/zca_" & ss & ".djhtm"
- With ie
- .Navigate rr
- Do While .readyState <> 4 'µ¥«Ýºô¶¤U¸ü§¹²¦
- DoEvents
- If Time >= T + #12:00:03 AM# Then
- DoEvents
- Application.SendKeys "~" 'ªÑ²¼¥N¸¹¿ù»~,ºô¶·|¦³°T®§,¶·«ö½T©w,¤~¥iÄ~Äò¤U±ªÑ²¼¥N¸¹
- Exit Do
- End If
- Loop
- Do
- Set S = .Document.getElementsByTagName("table")(2)
- Loop Until Not S Is Nothing
- With ¤u§@ªí3
- .UsedRange.Clear
- For i = 0 To S.Rows.Length - 1 '¼g¤J¸ê®Æ
- k = k + 1
- 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
- End With
- End With
- End Sub
- Private Sub GetIncome(ByVal ss As String) '¨ú·l¯qªí(¦~ªí)ºô¶
- Dim rr As String, T As Date, i, ii, k, j, S As Object
- T = Time
-
- rr = "http://kgieworld.moneydj.com/z/zc/zcq/zcqa/zcqa_" & ss & ".djhtm"
-
- With ie
- .Navigate rr
- Do While .readyState <> 4 'µ¥«Ýºô¶¤U¸ü§¹²¦
- DoEvents
- If Time >= T + #12:00:03 AM# Then
- DoEvents
- Application.SendKeys "~" 'ªÑ²¼¥N¸¹¿ù»~,ºô¶·|¦³°T®§,¶·«ö½T©w,¤~¥iÄ~Äò¤U±ªÑ²¼¥N¸¹
-
- Exit Do
- End If
- Loop
- Do
- Set S = .Document.getElementsByTagName("table")(2)
- Loop Until Not S Is Nothing
- With ¤u§@ªí4
- .UsedRange.Clear
- For i = 0 To S.Rows.Length - 1 '¼g¤J¸ê®Æ
- k = k + 1
- 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
- End With
- End With
- End Sub
- Private Sub GetBalance(ByVal ss As String) '¨ú¸ê²£t¶Åªí(¦~ªí)ºô¶
- Dim rr As String, T As Date, i, ii, k, j, S As Object
- T = Time
-
- rr = "http://kgieworld.moneydj.com/z/zc/zcp/zcpb/zcpb_" & ss & ".djhtm"
-
- With ie
- .Navigate rr
- Do While .readyState <> 4 'µ¥«Ýºô¶¤U¸ü§¹²¦
- DoEvents
- If Time >= T + #12:00:03 AM# Then
- DoEvents
- Application.SendKeys "~" 'ªÑ²¼¥N¸¹¿ù»~,ºô¶·|¦³°T®§,¶·«ö½T©w,¤~¥iÄ~Äò¤U±ªÑ²¼¥N¸¹
-
- Exit Do
- End If
- Loop
- Do
- Set S = .Document.getElementsByTagName("table")(2)
- Loop Until Not S Is Nothing
- With ¤u§@ªí5
- .UsedRange.Clear
- For i = 0 To S.Rows.Length - 1 '¼g¤J¸ê®Æ
- k = k + 1
- 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
- End With
- End With
- End Sub
- Private Sub GetShareholding(ByVal ss As String) '¨ú¸³ºÊ«ùªÑºô¶
- Dim rr As String, T As Date, i, ii, k, j, S As Object
- T = Time
- rr = "http://pscnetinvest.moneydj.com.tw/z/zc/zcj/zcj_" & ss & ".djhtm" '¨ú¸³ºÊ«ùªÑºô¶
- With ie
- .Navigate rr
- Do While .readyState <> 4 'µ¥«Ýºô¶¤U¸ü§¹²¦
- DoEvents
- If Time >= T + #12:00:03 AM# Then
- DoEvents
- Application.SendKeys "~" 'ªÑ²¼¥N¸¹¿ù»~,ºô¶·|¦³°T®§,¶·«ö½T©w,¤~¥iÄ~Äò¤U±ªÑ²¼¥N¸¹
-
- Exit Do
- End If
- Loop
- Do
- Set S = .Document.getElementsByTagName("table")(3)
- Loop Until Not S Is Nothing
- With ¤u§@ªí6
- .UsedRange.Clear
- For i = 0 To S.Rows.Length - 1 '¼g¤J¸ê®Æ
- k = k + 1
- 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
- End With
- End With
- End Sub
½Æ»s¥N½X |