- ©«¤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
|
¦^´_ 1# justintoolbox
¸Õ¸Õ¬Ý- Option Explicit
- Sub ºô¶_contentWindow()
- Dim my_url As String, xDate As String, E As Object, b As Object, i As Integer, R As Integer
- my_url = "http://mops.twse.com.tw/server-java/t13sa150_otc?step=0"
- With CreateObject("InternetExplorer.Application")
- ' .Visible = True
- .Navigate my_url
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- Set E = .Document.ALL(4).contentWindow.Document '³oºô¶¿é¤J¤¸¯À¦b³o¸Ì
- Set b = E.getElementsByTagName("SELECT")
- my_url = ""
- For i = 1 To b("bcode").Length
- my_url = my_url & " " & i & b("bcode")(i - 1).innerText & vbLf
- 'Ū¨ú¤ÀÃþ¶µ¥Øªº¤º®e
- Next
-
- Do
- i = Val(InputBox(my_url, , 1)) '¤ÀÃþ¶µ¥Øªº¿ï¾Ü
- If i = 0 Then
- If MsgBox("¤ÀÃþ¶µ¥Ø ¨S¦³¿ï¾Ü" & vbLf & "Â÷¶} µ{¦¡?", vbYesNo) = vbYes Then
- GoTo Exx
- End If
- End If
- Loop Until i > 0 And i <= b("bcode").Length
- Do
- xDate = Application.InputBox(Date, "½Ð¿é¤J¤é´Á", Date) '¸ê®Æ¤é´Á ¿é¤J
- If Not IsDate(xDate) Then
- If MsgBox("¸ê®Æ¤é´Á ¿é¤J¿ù»~" & vbLf & "Â÷¶} µ{¦¡?", vbYesNo) = vbYes Then
- GoTo Exx
- End If
- End If
- Loop Until IsDate(xDate)
- xDate = CDate(xDate) 'Âର¤é´Á«¬ºA
- b("bcode").selectedIndex = i - 1 '¤ÀÃþ¶µ¥Ø
- b("years").selectedIndex = Year(Date) - Year(xDate) '¦~«×
- b("months").selectedIndex = Month(xDate) - 1 '¤ë¥÷
- b("days").selectedIndex = Day(xDate) - 1 '¤é´Á
- For Each b In E.getElementsByTagName("INPUT")
- If b.Type = "submit" Then b.Click
- Next
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- '**** §@ªk1
- ' Set E = .Document.ALL(5).contentWindow.Document '³oºô¶¬d¸ß¸ê®Æ¦b³o¸Ì
- 'Set E = E.getElementsByTagName("table")(0)
- 'Ep E.outerHTML 'ºô¶¸ê®Æ¤å¦r
- '******************
- '**** §@ªk2
- Set E = .Document.ALL(5).contentWindow.Document '³oºô¶¬d¸ß¸ê®Æ¦b³o¸Ì
- Set E = E.getElementsByTagName("table")(0).Rows
- With Sheets(2)
- .UsedRange.Clear
- For Each b In E
- For i = 0 To b.Cells.Length - 1
- .Cells(R + 1, i + 1) = b.Cells(i).innerText
- Next
- R = R + 1
- Next
- End With
- Exx:
- .Quit
- End With
- MsgBox "ok"
- End Sub
- Sub Ep(S As String)
- With CreateObject("InternetExplorer.Application")
- .Navigate "about:Tabs"
- ' .Visible = True
- .Document.body.innerHTML = S
- .ExecWB 17, 2 ' Select All
- .ExecWB 12, 2 ' Copy selection
- With Sheets(1)
- .UsedRange.Clear
- .Range("A1").Select
- .PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:=False, NoHTMLFormatting:=True
- End With
- .Quit
- End With
- End Sub
½Æ»s¥N½X |
|