- ©«¤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
|
¦^´_ 1# wufonna
§ï¤Fµ{¦¡¤º®e
½Ð±Ðµ{¦¡¨S¥[¤J³o¬q On Error Resume Next '¤U¦æ·|¥X¿ù¡A¥[¤J³o¦æ¡A¥¼ª¾ì¦]¡C ·|¿ù»~¬Oºô¶¦³ªÅ®æªºÃö·Ë¶Ü?
½Ð±Ð¤j¤j¦p¦óקï ÁÂÁÂ- Option Explicit
- Dim ie As Object '¼Ò²Õ³Ì³»ºÝ Dim ¨Ñ³o¼Ò²Õªºµ{§Ç¨Ï¥ÎªºÅܼÆ
- Sub AllFile()
- Dim i As Integer, v, Y As Integer, S As String
- Dim z As Integer
- With ¤u§@ªí1
- Dim AR
- AR = .Range("C1:J1")
- .Range("C:J") = ""
- .Range("C1:J1") = AR
- z = 0
- For i = 2 To .Range("A" & .Rows.Count).End(xlUp).Row
-
- v = .Cells(i, 1).Value
- GetDividend (v)
- .Cells(i, 3).Resize(1, 7).Value = ¤u§@ªí2.Cells(7, 1).Resize(1, 7).Value
- If ¤u§@ªí2.Cells(7, 5).Value > 0 Then
- .Cells(i, 10).Value = 1
- z = z + 1
- Else
- .Cells(i, 10).Value = 0
- End If
- 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Ӥ륿¦¨ªø)
- .Cells(i, 11).Value = 1
- Else
- .Cells(i, 11).Value = 0
- End If
- Next
- ' MsgBox "¦@¦³" & z & "®a¥¿¦¨ªø"
- .Cells(1, 10).Value = "¥h¦~¦P´Á¦~¼W²v" & Split(Date, "/")(1) - 1 & "¤ë¥÷" & .Range("A" & .Rows.Count).End(xlUp).Row & "®a¦@¦³" & z & "®a¥¿¦¨ªø"
-
- End With
- End Sub
- Public Function MyFile(v As Integer, i As Integer)
- ' Dim i As Integer, v, Y As Integer, S As String
- With ¤u§@ªí1
- .Range("C" & v & ":J" & v) = "" '²M°£¤u§@ªí1,¦~«×½d³ò
- v = .Cells(i, 1).Value
- GetDividend (v)
- .Cells(i, 3).Resize(1, 7).Value = ¤u§@ªí2.Cells(7, 1).Resize(1, 7).Value
- If ¤u§@ªí2.Cells(7, 5).Value > 0 Then
- .Cells(i, 10).Value = 1
- Else
- .Cells(i, 10).Value = 0
- End If
- 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Ӥ륿¦¨ªø)
- .Cells(i, 11).Value = 1
- Else
- .Cells(i, 11).Value = 0
- End If
-
- End With
- End Function
- Private Sub GetDividend(ByVal ss As String) '¨úªÑ§Qºô¶ '2022/2/22 ´«³o¬qµ{¦¡½X ¦b https://www.mobile01.com/topicdetail.php?f=511&t=4737630&p=3 ªº21¼Ó
- Dim URL, HTMLsourcecode, GetXml, Table
- Dim i As Integer, j As Integer
- Set HTMLsourcecode = CreateObject("htmlfile")
- Set GetXml = CreateObject("msxml2.xmlhttp")
- URL = "http://pscnetinvest.moneydj.com.tw/z/zc/zch/zch_" & ss & ".djhtm"
- With GetXml
- .Open "GET", URL, False
- .setRequestHeader "Cache-Control", "no-cache"
- .setRequestHeader "Pragma", "no-cache"
- .setRequestHeader "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"
- .send
- HTMLsourcecode.body.innerhtml = .responsetext
- On Error Resume Next '¤U¦æ·|¥X¿ù¡A¥[¤J³o¦æ¡A¥¼ª¾ì¦]¡C
- Set Table = HTMLsourcecode.all.tags("table")(2).Rows
- For i = 0 To Table.Length - 1
- For j = 0 To Table(i).Cells.Length - 1
- ¤u§@ªí2.Cells(i + 1, j + 1) = Table(i).Cells(j).innertext
- Next j
- Next i
- End With
- Set HTMLsourcecode = Nothing
- Set GetXml = Nothing
- End Sub
½Æ»s¥N½X |
|