ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¬d§äºô¯¸¸ê®Æ

¦^´_ 5# ciboybj
¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub Ex()
  3.     Dim D  As Object, e As Object, URL As String
  4.     '¤u·~¥Î»Ã¯À
  5.     '¤u·~¥Î¤û¥¤µo»Ã¾¯
  6.     '²G´¹
  7.     '¨¾»G¾¯
  8.     '¤u·~¥Î°£¯ä¾¯
  9.     '¤u·~¥Î°®À꾯
  10.     '¤¤©M¾¯
  11.     URL = "http://tmsearch.tipo.gov.tw/TIPO_DR/GoodsIPOContent.jsp"
  12.     With CreateObject("InternetExplorer.Application")
  13.         .Navigate URL
  14.         .Visible = True
  15.          Do While .ReadyState <> 4 Or .Busy
  16.             DoEvents
  17.         Loop
  18.         Set D = .document.all(6).all(0).contentWindow.frames.document.getElementsByTagName("INPUT")
  19.         D("txtGoodsName").Value = "¤¤©M¾¯"
  20.         For Each e In D
  21.             If e.Value = "¬d¸ß" Then e.Click: Exit For
  22.         Next
  23.         Do While .ReadyState <> 4 Or .Busy
  24.             DoEvents
  25.         Loop
  26.         Set D = .document.LastChild.LastChild.all(1).contentWindow.frames.document.getElementsByTagName("table")
  27.         Ep D(0).outerHTML
  28.         .Quit
  29.     End With
  30. End Sub
  31. Private Sub Ep(S As String)
  32.     With CreateObject("InternetExplorer.Application")
  33.         .Navigate "about:Tabs"
  34.         .Visible = True
  35.        .document.body.innerhtml = S
  36.         .ExecWB 17, 2       '  Select All
  37.         .ExecWB 12, 2       '  Copy selection
  38.         With ActiveSheet
  39.             .Cells.Clear
  40.             .Range("A1").Select
  41.             .PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:=False, NoHTMLFormatting:=True
  42.         End With
  43.         .Quit
  44.     End With
  45. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 8# ciboybj
ª«¥ó¤£¤ä´©¦¹ÄݩʩΤèªk (¿ù»~ 438)
¤£¦n·N«ä§Ú¥u¦³2003ª©.µLªk´À§A­×¥¿

½Ð­×§ï6#ªºµ{¦¡½X
   
  1. Dim IE As Object
  2.     Set IE = CreateObject("InternetExplorer.Application")
  3.     With IE
  4.     'With CreateObject("InternetExplorer.Application")
½Æ»s¥N½X

¦³¿ù»~®É ½Ð¨ì¦p¹Ï IEª«¥ó§ä§ä "table" ¦b­þ¸Ì


·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 8# ciboybj
§ä¤F¤@¤U2010ª© ¸Õ¸Õ¬Ý¥i§ï¦¨¦p¤U
  1. ' Set D = .document.LastChild.LastChild.all(1).contentWindow.frames.document.getElementsByTagName("table")
  2.         Set D = .document.all(6).all(1).contentWindow.frames.document.getElementsByTagName("table")
½Æ»s¥N½X
¦^´_ 10# joey0415
Set D = .document.all(6).all(0).contentWindow.frames.document.getElementsByTagName("INPUT")
¸ÑÄÀ¦p¤U
.document->HTMLªº[¤å¥óª«¥ó]
.All->documentªºelement [¤¸¯À¶°¦X]
all(6):±Æ¦æ²Ä6¦ì(¤U­­¯Á¤Þ­È±q0 ¶}©l)ªº[¤¸¯À];.all(0)±Æ¦æ²Ä0ªº[¤¸¯À];  
contentWindowÄݩʬO«ü«ü©wªºframe©ÎªÌiframe©Ò¦bªºwindowª«¥ó
getElementsByTagName("INPUT")->¤¸¯À¤¤ªºTagName¬°"INPUT"ªº¶°¦Xª«¥ó
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 13# joey0415


   
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 15# joey0415


   
vba¤º«Øªº¸ê®Æ¦r«¬¤£¯à©ñ¤j

¬O³o­Ó¶Ü?

·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-8-8 09:51 ½s¿è

¦^´_ 17# ciboybj


   
¦³¨Ç¬d¸ß¸ê®Æ(¨Ò¦p¬d¸ß"¹q¸£")·|¦³¤U¤@­¶ªº°ÝÃD

­þ­n¥ý¬Ý³oºô­¶ªº­ì©l¤å¥ó [¤U¤@­¶]Á䪺¦WºÙ.
  1. Sub ¤é³øªí()
  2.     Dim D  As Object, E As Object, P As Integer, URL As String, ­¶¼Æ As Integer, i As Integer
  3.     Dim P_down As Object
  4.     URL = "http://bsr.twse.com.tw/bshtm/"
  5.     With CreateObject("InternetExplorer.Application")
  6.         .Navigate URL
  7.         .Visible = True
  8.          Do While .readyState <> 4 Or .Busy
  9.             DoEvents
  10.         Loop
  11.         Set D = .Document.all(5).all(0).contentWindow.frames.Document.getelementsbytagname("INPUT")
  12.         
  13.         D("txtTASKNO").Value = "1101"
  14.         For Each E In D
  15.             If E.Value = "¬d¸ß" Then E.Click: Exit For
  16.         Next
  17.         Do While .readyState <> 4 Or .Busy
  18.             DoEvents
  19.         Loop
  20.         ­¶¼Æ = .Document.all(5).all(0).contentWindow.frames.Document.getElementsByName("sp_ListCount")(0).INNERTEXT
  21.          For Each E In .Document.all(5).all(0).contentWindow.frames.Document.getelementsbytagname("INPUT")
  22.                 If E.Value = "¤U¤@­¶" Then Set P_down = E: Exit For
  23.             Next
  24.          ActiveSheet.Cells.Clear
  25.          .Document.Focus
  26.         For P = 1 To ­¶¼Æ
  27.             Set D = Nothing
  28.             Do
  29.                 DoEvents
  30.                 Set D = .Document.all(5).all(1).contentWindow.frames.Document.getelementsbytagname("table") '
  31.                
  32.             Loop Until Not D Is Nothing And D.Length = 7
  33.             For i = IIf(P = 1, 3, 4) To 4
  34.                 Ep D(i).outerHTML
  35.             Next
  36.             P_down.Click
  37.             Do While .readyState <> 4 Or .Busy
  38.                 DoEvents
  39.             Loop
  40.         Next
  41.         .Quit
  42.     End With
  43. End Sub
  44. Private Sub Ep(s As String) ' A(A.Length - 1).outerHTML
  45.     With CreateObject("InternetExplorer.Application")
  46.         .Navigate "about:Tabs"
  47.         .Visible = True
  48.         .Document.body.innerHTML = s
  49.         .ExecWB 17, 2       '  Select All
  50.         .ExecWB 12, 2       '  Copy selection
  51.         With ActiveSheet
  52.           '  MsgBox .UsedRange.Rows.Count
  53.             .Range("A" & IIf(.UsedRange.Rows.Count = 1, 1, .UsedRange.Rows.Count + 1)).Select
  54.             .PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:=False, NoHTMLFormatting:=True
  55.         End With
  56.         .Quit
  57.     End With
  58. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 20# joey0415
ÁÂÁ¶Wª©¸Ñ¨M³o­Ó°ÝÃD¡IÁöµM§Ú¤£¬O¥Î³o­Ó¤èªk§ìªº¡I¤£¹LÁÙ¬O­n·PÁÂ

¥i§_PO¤W¨Ó¥æ¬y.
.all(5)ªº5§Ú¬O¤@­Ó¤@­Ó¸Õ¥X¨Óªº
¶Wª©¤]¬O¤@­Ó¤@­Ó¸Õ¥X¨Óªº¶Ü¡H
ÁÙ¬O¦³§Oªº»yªk¥i¥Hlist¥X¨Ó©O¡H

¥ÎIE»yªkŪ¨úºô­¶¸ê®Æ,§Ú¤]¬Oºô¸ô¤W¾Ç¨Óªº
.Document.Focus
¬°¤°»ò­n³o¥y©O¡H¦³¤°»ò®t§O¡H

¦]¸Ó¨S®t§Oªº,¦]µ{¦¡¦³®É·|¥X¿ù,¥[¤W«á«Ü¬yºZ.
¥kÃ䪺¬Oframe¬°¤°»ò¤]¬Oall(0)¦Ó¤£¬Oall(1)

11# ¦³µù©ú   all(6):±Æ¦æ²Ä6¦ì(¤U­­¯Á¤Þ­È±q0 ¶}©l)ªº[¤¸¯À];.all(0)±Æ¦æ²Ä0ªº[¤¸¯À]
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 13# joey0415
µ¹§A°Ñ¦Ò
  1. Option Explicit
  2. Sub ªÑ²¼¤é³øªí()                        '¬d¸ß³æ¤@ªÑ²¼
  3.     Dim ªÑ²¼¥N¸¹ As String, ­¶¼Æ As String, T As Date
  4.     Do While ªÑ²¼¥N¸¹ = ""
  5.         ªÑ²¼¥N¸¹ = InputBox("ªÑ²¼¥N¸¹", "¿é¤J¬d¸ß¤§ªÑ²¼¥N¸¹", "1101")
  6.         If ªÑ²¼¥N¸¹ = "" Then End
  7.     Loop
  8.     T = Time
  9.     ­¶¼Æ = ³øªí­¶¼Æ(ªÑ²¼¥N¸¹)
  10.     If ­¶¼Æ <> "" Then
  11.         ¶×¤J¤é³øªí ªÑ²¼¥N¸¹, ­¶¼Æ
  12.        MsgBox Format(Time - T, "§¹¦¨ ¶O®É HH:MM:SS")
  13.     Else
  14.         MsgBox "ªÑ²¼¥N¸¹  " & ªÑ²¼¥N¸¹ & " ¦³»~ !!!"
  15.     End If
  16. End Sub
  17. Private Sub ¶×¤J¤é³øªí(ªÑ²¼¥N¸¹ As String, ­¶¼Æ As String)      '°Ñ¼Æ¶Ç°e¨Óªº --ªÑ²¼¥N¸¹ & ­¶¼Æ
  18.     Dim Rng As Range
  19.     With ActiveSheet
  20.         If .QueryTables.Count = 0 Then
  21.             With .QueryTables.Add("URL;about:Tabs", .[A1])
  22.                 .Refresh BackgroundQuery:=False
  23.             End With
  24.         End If
  25.         With .QueryTables(1)
  26.             .Connection = "URl;http://bsr.twse.com.tw/bshtm/bsContent.aspx?StartNumber=" & ªÑ²¼¥N¸¹ & "&FocusIndex=All_" & ­¶¼Æ
  27.             .WebFormatting = xlWebFormattingNone
  28.             .WebTables = "4,""table2"""
  29.             .Refresh False
  30.         End With
  31.         Set Rng = .UsedRange.Offset(6)
  32.          With Rng.Columns("A")
  33.             .Replace "§Ç", "=Why", xlWhole
  34.             .SpecialCells(xlCellTypeFormulas, xlErrors).Value = ""
  35.             .SpecialCells(xlCellTypeBlanks).EntireRow.Delete
  36.         End With
  37.         .Cells(1).Select
  38.     End With
  39. End Sub
  40. Private Function ³øªí­¶¼Æ(ªÑ²¼¥N¸¹ As String)   '°Ñ¼Æ¶Ç°e¨Óªº --ªÑ²¼¥N¸¹
  41.     With CreateObject("InternetExplorer.Application")
  42.             .Navigate "http://bsr.twse.com.tw/bshtm/bsMenu.aspx"
  43.             Do While .Busy Or .readyState <> 4
  44.                 DoEvents
  45.             Loop
  46.             .document.getElementsByName("txtTASKNO").Item(0).Value = ªÑ²¼¥N¸¹
  47.             .document.getElementsByName("btnOK")(0).Click
  48.             Do While .Busy Or .readyState <> 4
  49.                 DoEvents
  50.             Loop
  51.             ³øªí­¶¼Æ = .document.getElementsByName("sp_ListCount")(0).innertext
  52.             .Quit
  53.     End With
  54. End Function
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-8-14 09:41 ½s¿è

¦^´_ 25# cadillac
  1. Private Function ³øªí­¶¼Æ(ªÑ²¼¥N¸¹ As String)   '°Ñ¼Æ¶Ç°e¨Óªº --ªÑ²¼¥N¸¹
  2.     With CreateObject("InternetExplorer.Application")
  3.             .Navigate "http://bsr.twse.com.tw/bshtm/bsMenu.aspx"
  4.             Do While .Busy Or .readyState <> 4
  5.                 DoEvents
  6.             Loop
  7.             '³o¸Ì¨S¿ù»~ *****
  8.             .document.getElementsByName("txtTASKNO").Item(0).Value = ªÑ²¼¥N¸¹         
  9.          .document.getElementsByName("btnOK")(0).Click    '³o¸Ì¬°¦ó¨S¿ù»~???******
  10.             Do While .Busy Or .readyState <> 4
  11.                 DoEvents
  12.             Loop
  13.             '¥i¥H¦Û¤v §ï¤@§ï***********
  14.             ³øªí­¶¼Æ = .document.getElementsByName("sp_ListCount")(0).innertext
  15.             .Quit
  16.     End With
  17. End Function
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2014-8-15 06:35 ½s¿è

¦^´_ 28# cadillac
ºô­¶³]¦³[»{ÃÒ½X],­­¨î¥Îµ{¦¡¤U¸ü.¥\¤O¤£°÷¯}¸Ñ¤£¤F.

§A¦³¬d¥Xºô­¶­ì©l½X<span id="sp_ListCount">15</span>
¸Õ¸Õ¬Ý
  1. .document.getElementByID("sp_ListCount").INNERTEXT            
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ¯u¥¿ªº·R¤ß¡A¬O·ÓÅU¦n¦Û¤vªº³oÁû¤ß¡C
ªð¦^¦Cªí ¤W¤@¥DÃD