- ©«¤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 ©ó 2013-5-19 15:36 ½s¿è
¦^´_ 1# randomwalk
³oºô¶: µL½×¬O[³Ì·s¸ê®Æ] ©Î [¾ú¥v¸ê®Æ] ªº¸ê®Æ³£¤@¼Ë???- Sub Ex()
- Dim i As Integer, s As Integer, k As Integer, A, ii, j
- Dim co_id As String, isnew As String, season As String
- co_id = InputBox("½Ð¿é¤J ¤½¥q¥N¸¹")
- If Not IsNumeric(Val(co_id)) Or Len(co_id) <> 4 Then Exit Sub '¤£¬O¥|¦ì¼Æªº¼Æ¦r
- isnew = InputBox("1:³Ì·s¸ê®Æ¡A¢±:¾ú¥v¸ê®Æ" & vbLf & "½Ð¿ï 1 , 2")
- If isnew <> "1" And isnew <> "2" Then Exit Sub '¨S¿ï1 ©Î 2
- If isnew = "2" Then season = InputBox("¿é¤J¦~«× , ©u§O" & vbLf & "¨Ò 101,01")
- '²Ä¤@©u 01,²Ä¤G©u 02²Ä¤T©u 03,²Ä¥|©u 04.
- With CreateObject("InternetExplorer.Application")
- .Visible = True
- .Navigate "http://mops.twse.com.tw/mops/web/t164sb04"
- Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
- With .document
- For Each A In .getelementsbytagname("INPUT")
- If A.Name = "co_id" Then A.Value = co_id
- Next
- For Each A In .getelementsbytagname("SELECT")
- If A.Name = "isnew" Then
- A.Value = True
- If isnew = "2" Then
- A.Focus
- Application.Wait Now + #12:00:02 AM#
- Application.SendKeys "{DOWN}"
- Application.Wait Now + #12:00:02 AM#
- Application.SendKeys "{ENTER}"
- End If
- End If
- If A.Name = "year" And isnew = "2" Then A.Value = Split(season, ",")(0)
- If A.Name = "season" And isnew = "2" Then A.Value = Split(season, ",")(1)
- Next
- For Each A In .getelementsbytagname("INPUT")
- If Trim(A.Value) = "·j´M" And A.Name <> "rulesubmit" Then A.Click '«ö¤U[·j¯Á]Áä
- Next
- End With
- Application.Wait Now + #12:00:10 AM# 'µ¥«Ýºô¶¤U¸ü¸ê®Æ
- Set A = .document.getelementsbytagname("table")
- On Error Resume Next '***¦³¨Çtable¨SRows¸ê®Æ·|²£¥Í¿ù»~ ¤£²z·|¥¦,µ{¦¡Ä~Äò¨«
- With ActiveSheet
- .Cells.Clear
- '************************
- ' For ii = 0 To A.Length - 1 '¤£ª¾¹Dtable½d³ò¦b¦ó³B: ±q0¶}©l
- '******************************
- For ii = 11 To A.Length - 1 ''±q11¶}©l ¥Î Debug.Print ii §ä¥X©Òn¸ê®Æªºtable½d³ò
- For i = 0 To A(ii).Rows.Length - 1 '¼g¤J¸ê®Æ
- 'Debug.Print ii ¥i§ä¥X©Òn¸ê®Æªº table ½d³ò
- k = k + 1
- For j = 0 To 5
- Cells(k, j + 1) = A(ii).Rows(i).Cells(j).innerText
- Next
- Next
- Next
- .Range("C5").Cut Range("D5")
- With .Range("B5:C5,D5:E5")
- .HorizontalAlignment = xlCenter
- .VerticalAlignment = xlCenter
- .Merge
- End With
- End With
- .Quit 'Ãö³¬ºô¶
- End With
- End Sub
½Æ»s¥N½X- Option Explicit
- Dim ºô¶ As Object
- Sub Ex²©ö¤â°Ê()
- 'µ{¦¡²Ä¤@¦¸°õ¦æ: ¥´¶}ºô¶,¦bºô¶¤¤¤â°Ê,¿ï¾Ü¸ê®Æ«á , «ö[·j´M]Áä!!
- 'µ{¦¡²Ä¤G¦¸°õ¦æ: Ū¨úºô¶¸ê®Æ¨ì Excel¤¤.
- '©¹«á¦bºô¶¸ê®Æ¦³×§ï,¥u»Ý°õ¦æ¤@¦¸§Y¥iŪ¨úºô¶¸ê®Æ¨ì Excel¤¤.
- Dim i As Integer, ii As Integer, k As Integer, j As Integer, A As Object
- On Error GoTo REºô¶
- 1:
- If ºô¶ Is Nothing Then
- Set ºô¶ = CreateObject("InternetExplorer.Application")
- With ºô¶
- .Visible = True
- .Navigate "http://mops.twse.com.tw/mops/web/t164sb04"
- .Height = 500
- .Width = 1300
- End With
- Application.WindowState = xlMinimized 'Excel ³Ì¤p¤Æ
- Exit Sub
- End If
- If ºô¶.Visible = False Then
- ºô¶.Value = True
- Application.WindowState = xlMinimized
- Exit Sub
- End If
- '**********Ū¨úºô¶ ¸ê®Æ *******************
- Set A = ºô¶.document.getelementsbytagname("table")
- With ActiveSheet '§@¥Î¤¤ªº¤u§@ªí
- .Cells.Clear
- On Error Resume Next
- For ii = 11 To A.Length - 1
- For i = 0 To A(ii).Rows.Length - 1 '¼g¤J¸ê®Æ
- k = k + 1
- For j = 0 To 5
- Cells(k, j + 1) = A(ii).Rows(i).Cells(j).innerText
- Next
- Next
- Next
- .Range("C5").Cut .Range("D5")
- With .Range("B5:C5,D5:E5")
- .HorizontalAlignment = xlCenter
- .VerticalAlignment = xlCenter
- .Merge
- End With
- End With
- Exit Sub
- REºô¶: '
- Set ºô¶ = Nothing
- Resume 1
- End Sub
½Æ»s¥N½X |
|