- ©«¤l
 - 112 
 - ¥DÃD
 - 19 
 - ºëµØ
 - 0 
 - ¿n¤À
 - 136 
 - ÂI¦W
 - 0  
 - §@·~¨t²Î
 - window 
 - ³nÅ骩¥»
 - excel 
 - ¾\ŪÅv
 - 20 
 - ©Ê§O
 - ¨k 
 - µù¥U®É¶¡
 - 2013-3-12 
 - ³Ì«áµn¿ý
 - 2022-11-29 
 
   
 | 
                
sheet1 ¦s©ñ¤@¦~ªºªÑÅvÅÜ´«¸ê®Æ 
sheet2 ¦s©ñ¤@¦~ªºªÑÅv¦³®Ä¤é´Á 
sheet3 §ì¤U¨C¤ëªÑÅvªºªÑÅvÅÜ´«¸ê®Æ¨Ã¦s©ñ¨ìsheet1 
sheet4 ªÑ²¼¥N¸¹¡A©¡®É³o¸Ì¬O¥i¥HÅܼƤ覡¨Ó§ì¨ú·QÆ[¹îªºªÑÅvÅÜ´«¸ê®Æ 
 
©ó¬O±NG¤jªº®æ¦¡×§ï¦p¤U¡G- Sub ¶°«O¤áªÑÅv¤À´²ªí¬d¸ß_WEB()
 
 -     Dim Ar(), A, i As Integer, strDate As String, stkno As String, Qur As String
 
 -     With CreateObject("InternetExplorer.Application")
 
 -         .Navigate "http://www.tdcc.com.tw/smWeb/QryStock.jsp"
 
 -         Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
 
 -         Set A = .document.All.tags("option") '¸ê®Æ¤é´Áªº¤º®e
 
 -         ReDim Ar(A.Length - 1)
 
 -         For i = 0 To A.Length - 1
 
 -             Ar(i) = A(i).innerHTML
 
 -             If InStr(Ar(i), Format(Date, "YYYYMM")) Then strDate = Ar(i) '¾É¤J·í¤ë¤é´Á
 
 -         Next
 
 -         .Quit
 
 -     End With
 
 -     
 
 -     For DQ = 1 To 3
 
 -     Sheets(DQ).Select
 
 -     Cells.Clear
 
 -     Next DQ
 
 -         
 
 -     For i = 1 To 12
 
 -     Sheets(2).Select
 
 -     Range("a" & i + 1).Value = Ar(i)
 
 -     Next i
 
 -     
 
 -     Range("a" & 14).Value = Ar
 
 -     
 
 -     With Worksheets(2)              'sorting
 
 -       Range("A1:ac20").Sort _
 
 -       Key1:=.Range("a1"), _
 
 -       Order1:=xlDescending, _
 
 -       Header:=xlYes, _
 
 -       Orientation:=xlTopToBottom
 
 -     End With
 
 - 'End Sub
 
 -     
 
 -     TotalDate2 = 1
 
 -             
 
 -     For Totaldate = 2 To 14
 
 -     'Do
 
 -     '    strDate = InputBox(Join(Ar, vbTab), "¶°«O¤áªÑÅv¤À´²ªí¬d¸ß ¤§ ¦³®Ä¤é´Á", strDate)
 
 -      strDate = Sheets(2).Range("a" & Totaldate)
 
 -     '    If strDate = "" Then Exit Sub
 
 -      
 
 -     'Loop Until IsNumeric(Application.Match(strDate, Ar, 0))
 
 -     
 
 -     stkno = Sheets(4).Range("a1")    '
 
 -     
 
 -     If stkno = "" Then Exit Sub
 
 -     Qur = "http://www.tdcc.com.tw/smWeb/QryStock.jsp?SCA_DATE=" & strDate & "&SqlMethod=StockNo&StockNo=" & stkno & "&StockName=&sub=%ACd%B8%DF"
 
 -     If Sheets(3).QueryTables.Count = 0 Then
 
 -         Sheets(3).QueryTables.Add "URL;" & Qur, Sheets(3).[A1]
 
 -     Else
 
 -         Sheets(3).QueryTables(1).Connection = "URL;" & Qur
 
 -     End If
 
 -     With Sheets(3).QueryTables(1)
 
 -         .Name = "«ùªÑ¤À§G"
 
 -         .FieldNames = True
 
 -         .RowNumbers = False
 
 -         .FillAdjacentFormulas = False
 
 -         .PreserveFormatting = False
 
 -         .RefreshOnFileOpen = False
 
 -         .BackgroundQuery = True
 
 -         .RefreshStyle = xlOverwriteCells
 
 -         .SavePassword = False
 
 -         .SaveData = True
 
 -         .AdjustColumnWidth = False
 
 -         .RefreshPeriod = 0
 
 -         .WebSelectionType = xlSpecifiedTables
 
 -         .WebFormatting = xlWebFormattingNone
 
 -         .WebTables = "6,7,8"
 
 -         .WebPreFormattedTextToColumns = True
 
 -         .WebConsecutiveDelimitersAsOne = True
 
 -         .WebSingleBlockTextImport = False
 
 -         .WebDisableDateRecognition = False
 
 -         .WebDisableRedirections = False
 
 -         .Refresh BackgroundQuery:=False
 
 -     End With
 
 -     
 
 -     Worksheets(3).Select                       '¦¬¶°¸ê®Æ¨ìsheet1
 
 -     Range("a3:e21").Select
 
 -     Application.CutCopyMode = False
 
 -     Selection.Copy
 
 -     
 
 -     
 
 -     Worksheets(1).Select
 
 -     Range("a" & TotalDate2).Select
 
 -     ActiveSheet.Paste
 
 -     TotalDate2 = TotalDate2 + 20
 
 -     
 
 -     Next Totaldate
 
 - End Sub
 
  ½Æ»s¥N½X |   
 
 
 
 |