- ©«¤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
|
¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-11-23 16:02 ½s¿è
¦^´_ 5# HSIEN6001
¸Õ¸Õ¬Ý- Dim ºô¶ As Object, Ar1 As String, xPath As String
- Sub EX_¦Û°Ê()
- Dim i As Integer, k As Integer, AR() As String, j As Integer
- xPath = "d:\" '¦sÀɦì¸m,¦Û¤v×¥¿¤@¤U
- Ar1 = ""
- ¦~«× = "103"
- ©u´Á = "3"
- ¥N¸¹ = "2880"
- Set ºô¶ = CreateObject("InternetExplorer.Application")
- With ºô¶
- '.Visible = True
- .Navigate "http://mops.twse.com.tw/mops/web/t164sb04?'encodeURIComponent=1&step=1&firstin=ture&off=1&keyword4=&code1=&TYPEK2=&checkbtn=&queryName=co_id&TYPEK=all&isnew=false&co_id=" & ¥N¸¹ & "&year=" & ¦~«× & "&season=" & ©u´Á
-
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- If InStr(.Document.body.innertexT, "¬dµL¤½¥q¸ê®Æ") Then
- MsgBox ¥N¸¹ & " : ¬dµL¤½¥q¸ê®Æ!"
- .Quit
- End
- End If
- '**************** Ū¨ú ª÷±±ªÑ¤l¤½¥q¦WºÙ
- With .Document.getElementsByTagName("TABLE")(11)
- ReDim AR(1 To .Rows.Length - 1)
- For i = 1 To .Rows.Length - 1
- For j = 0 To .Rows(i).Cells.Length - 2
- AR(i) = AR(i) & IIf(AR(i) <> "", "-", "") & .Rows(i).Cells(j).innertexT
- Next
- Next
- End With
- '*****************************
- Set A = .Document.getElementsByTagName("INPUT")
- i = 1
- For E = 0 To A.Length - 1
- If A(E).Value = "¸Ô²Ó¸ê®Æ" And A(E).Type = "button" Then
- A(E).Click '¦³"¸Ô²Ó¸ê®Æ" ª÷±±ªÑ¤l¤½¥qªº«ö¶s
- Do While ºô¶.Busy Or ºô¶.readyState <> 4: DoEvents: Loop
- If InStr(.Document.body.innertexT, "¬dµL") = 0 Then 'ª÷±±ªÑ¤l¤½¥q¦³¸ê®Æ
- IE_Table AR(i) '°Ñ¼Æ¶Ç»¼:ª÷±±ªÑ¤l¤½¥qªº¦WºÙ
- End If
- For Each Img In .Document.getElementsByTagName("img")
- 'http://mops.twse.com.tw/mops/web/images/bu_05.gif ¦^¤W¶ªº¹Ï¤ù
- If Img.href = "http://mops.twse.com.tw/mops/web/images/bu_05.gif" Then
- Img.Click
- Do While ºô¶.Busy Or ºô¶.readyState <> 4: DoEvents: Loop
- Exit For
- End If
- Next
- i = i + 1 '¤U¤@Ó ª÷±±ªÑ¤l¤½¥q
- End If
- Next
- .Quit
- End With
- MsgBox Ar1 & vbLf & "¦sÀÉ " & UBound(Split(Ar1, vbLf)) + 1 & " Ó §¹²¦", , AR(1)
- End Sub
- Private Sub IE_Table(co_id As String)
- Dim A As Object, i, k, j
- Do
- Set A = ºô¶.Document.getElementsByTagName("table") '(12)
- Loop Until Not A Is Nothing And A.Length >= 14
- Set A = A(12)
- With Workbooks.Add(1)
- For i = 0 To A.Rows.Length - 1
- k = k + 1
- For j = 0 To A.Rows(i).Cells.Length - 1
- .Sheets(1).Cells(k, j + 1) = A.Rows(i).Cells(j).innertexT
- Next
- Next
- If Dir(xPath & co_id & ".xls") <> "" Then Kill (xPath & co_id & ".xls")
- .SaveAs Filename:=xPath & co_id & ".xls"
- .Close
- End With
- Ar1 = Ar1 & IIf(Ar1 <> "", vbLf, "") & co_id
- End Sub
½Æ»s¥N½X |
|