¦³ÃöEXCEL VBA §ì¨ú¤£¨ì§¹¾ãºô§}CSV°ÝÃD
- ©«¤l
- 11
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 14
- ÂI¦W
- 0
- §@·~¨t²Î
- xp
- ³nÅ骩¥»
- 2007
- ¾\ŪÅv
- 10
- µù¥U®É¶¡
- 2011-9-17
- ³Ì«áµn¿ý
- 2017-4-24
|
¦³ÃöEXCEL VBA §ì¨ú¤£¨ì§¹¾ãºô§}CSV°ÝÃD
¦U¦ì°ª¤â±z¦n¡A
¦]n§ì¥ý«e¤wª¦¤å¡Ahttp://forum.twbts.com/viewthread.php?tid=10770¡Aקï¹L«á¡A¸ê¤´±a¤£¥X¨Ó¡A½Ð·Q°Ý¦U¦ì°ª¤â¬O§_php«á±ªº»yªk¨Ï¥Î¦³»~¡AÁÂÁ¤j®a^^
http://www.twse.com.tw/ch/trading/exchange/TWT93U/TWT93U.php- Option Explicit
- Sub ExA()
- With ActiveSheet
- With .QueryTables.Add("URL;http://www.twse.com.tw/ch/trading/exchange/TWT93U/TWT93U.php#?combination_choice=sub&cno=1&input_date=103/02/25", .[A1])
- .WebSelectionType = xlSpecifiedTables
- .WebFormatting = xlWebFormattingNone
- .WebTables = """data_table"""
- .WebPreFormattedTextToColumns = True
- .WebConsecutiveDelimitersAsOne = True
- .WebSingleBlockTextImport = False
- .WebDisableDateRecognition = False
- .WebDisableRedirections = False
- .Refresh BackgroundQuery:=False
- End With
- End With
- End Sub
½Æ»s¥N½X- Sub TEST123()
- Dim YMD_day As String, N As Name, webURL As String
- YMD_day = InputBox("¿é¤J ¥Á°ê¦~«×¤é´Á : 102/10/07", "¤U¸ü¯S©w¤é´Áªº¸ê®Æ", Format(Date - 1, "E/MM/DD"))
- With Sheets("¤U¸ü¸ê®Æ")
- For Each N In .Names
- 'N.Delete
- Next
- .Cells.Clear
- GetData_URL = "URL;http://www.twse.com.tw/ch/trading/exchange/TWT93U/TWT93U.php?edition=ch&filename=genpage/A" & YMD_day & ".dat&type=csv"
- 'webURL = "URL; http://www.twse.com.tw/ch/trading/block/BFIAUU/BFIAUU.php?input_date=" & YMD_day & "&login_btn=¬d¸ß.dat"
- With .QueryTables.Add(Connection:=GetData_URL, Destination:=.Range("A1"))
- .WebSelectionType = xlSpecifiedTables
- .WebFormatting = xlWebFormattingNone
- .WebTables = "data_table"
- .WebPreFormattedTextToColumns = True
- .WebConsecutiveDelimitersAsOne = False
- .WebSingleBlockTextImport = False
- .WebDisableDateRecognition = False
- .WebDisableRedirections = True
- .Refresh BackgroundQuery:=False
- End With
- End With
- End Sub
½Æ»s¥N½X |
|
|
|
|
|
|
- ©«¤l
- 36
- ¥DÃD
- 7
- ºëµØ
- 0
- ¿n¤À
- 76
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- 2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-10-1
- ³Ì«áµn¿ý
- 2016-3-21
|
¦^´_ 48# GBKEE
¤j¤j«È®ð¤F¡An»¡¤£¦n·N«äªº¬O§Ú¡A³o¼Ë³Ò·Ð¤j¤j¡A
¥i¥H°õ¦æ¡Aµ²ªG´N¬O§Ú·Q¹³«Ü¤[ªº¼Ë¤l(«öNÓÆg)¡A¤Ó·PÁ¤F ~~~ |
|
|
|
|
|
|
- ©«¤l
- 36
- ¥DÃD
- 7
- ºëµØ
- 0
- ¿n¤À
- 76
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- 2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-10-1
- ³Ì«áµn¿ý
- 2016-3-21
|
¥»©«³Ì«á¥Ñ jak ©ó 2014-5-24 19:11 ½s¿è
¦^´_ 46# GBKEE
¤j¤j¤£¦n·N«ä¡A³o»ò±ß¤~¦^¤å¡Aקï«á°õ¦æ¥X²{¿ù»~¡A¥i¥H½Ð¤j¤j¬Ý¤@¤U§Úþ¸Ì©ñ¿ù¶Ü¡H·PÁÂ- Option Explicit
- Dim FormDLL As String, xDate As Date, Sh As Worksheet ', Msg As Boolean
- Sub Ie_Table()
- Dim URL As String, A As Object, i As Integer, E As Range
- Set_FormDLL
- URL = "http://stocker.com.tw/"
- xDate = Date - 1
- If Weekday(xDate, vbMonday) > 5 Then
- Do While Weekday(xDate, vbMonday) > 5
- xDate = xDate - 1
- Loop
- End If
- Set Sh = Sheets.Add 'µ²ªGÅã¥Ü¦b·s¼Wªº¤u§@ªí
- Sh.Name = Format(xDate, "yyyy-mm-dd") '©R¦W¬°¤é´Á
- With CreateObject("InternetExplorer.Application")
- .navigate URL
- .Visible = True
- For Each E In Sheets("¤U¸ü¥N¸¹¦W³æ").Range("A3", Sheets("¤U¸ü¥N¸¹¦W³æ").[A3].End(xlDown))
- Do While .Busy Or .ReadyState <> 4: Loop
- With .document.getElementsByTagName("input")
- .Item("StoNum").Value = E
- .Item("datestart").Value = Format(xDate, "yyyy-mm-dd")
- For i = 0 To .Length - 1
- If .Item(i).Type = "submit" Then .Item(i).Click
- Next
- End With
- Do While .Busy Or .ReadyState <> 4: Loop
- Set A = .document.getElementsByTagName("TABLE")
- Ep A(A.Length - 1).outerHTML, E 'קï¤@¤U
- Next
- .Quit
- End With
- Remove_FormDLL
- End Sub
- Sub Ep(S As String, Code As StdFont)
- Dim D As New DataObject, E As Shape
- 'DataObject ª«¥ó ¦b¶i¦æÂà´«°Ê§@®É¡A°µ¬°®æ¦¡¤Æ¤å¦r¸ê®Æªº¼È¦s°Ï°ì¡C¨ä¤]¥i¥H¼È¦s©MÀx¦s¦b DataObject ªº¤å¦r¤ù¬q¬ÛÃöªº®æ¦¡¡C
- '«Å§i Dim D As New DataObject '¶·¦b¤u¨ã-> ³]©w¤Þ¥Î¶µ¥Ø¥[¤J ·s¼W¤Þ¥Î Microsoft Forms 2.0 Object Library ,±M®× ¥[¤J¤@ªí³æ§Y¥i
- With D
- .SetText S
- .PutInClipboard
- With Sh.UsedRange
- If .Rows.Count = 1 Then
- .Cells(1).Select
- Else
- .Rows(.Rows.Count).Cells(2).Select
- End If
- Sh.PasteSpecial Format:="Unicode ¤å¦r"
- With ActiveCell
- .Cells(2, 1) = "¥N¸¹"
- .Cells(3, 1).Resize(.Parent.UsedRange.Rows.Count - .Cells(3, 1).Row) = Code
- End With
-
- End With
- End With
- End Sub
- Sub Set_FormDLL() '·s¼W¤Þ¥Î Microsoft Forms 2.0 Object Library
- On Error Resume Next
- FormDLL = "FM20.DLL"
- ThisWorkbook.VBProject.References.AddFromFile "C:\windows\system32\FM20.DLL"
- '"C:\windows\system32\"¬O2003ª©ªº¸ô®|,2003¥H¤Wª©¥»»Ýקï¸ô®|
- End Sub
- Sub Remove_FormDLL() '§R°£¤Þ¥Î Microsoft Forms 2.0 Object Library
- Dim D As Object
- For Each D In ThisWorkbook.VBProject.References
- If UCase(D.fullpath) Like "*" & FormDLL Then
- ThisWorkbook.VBProject.References.Remove D
- End If
- Next
- End Sub
½Æ»s¥N½X |
|
|
|
|
|
|
- ©«¤l
- 36
- ¥DÃD
- 7
- ºëµØ
- 0
- ¿n¤À
- 76
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- 2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-10-1
- ³Ì«áµn¿ý
- 2016-3-21
|
¦^´_ 44# GBKEE
¤Ó¯«¤F¡A¤U¸ü¤S§Ö¤SáA·PÁ¤j¤jÀ°¦£¡A
ÁÙ¦³§ì¤U¨Óªºµ²ªGAÄæ¬O"¤é´Á"¡A¦³¨S¦³¿ìªk§ï¦¨¸Ó¤½¥qªº"¥N¸¹"©O¡H |
|
|
|
|
|
|
- ©«¤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
|
Y¬O§Ú·Qcopy¤U¦Cºô§}¬Y¤Ñ¡B¬Y´X®aªº¸ê®Æ¡Ahttp://stocker.com.tw/
¥i§_½Ð¤j¤j¼·¤¾À°¦£¡A¦³ªþÀÉ
jak µoªí©ó 2014/3/6 11:38
©êºp,¨S¦³ª`·N¨ì,¤[µ¥¤F.
¸Õ¸Õ¬Ý- <input type="text" name="StoNum" id="StoNum" style="width:100px" value="1101" onkeyup="findStoNum()">
- '<input type="text" name="datestart" id="datepicker" style="width:80px" value="2014-05-09" class="hasDatepicker">
- '<input type="submit" class="senddata" value="´£¥æ">
- Option Explicit
- Dim FormDLL As String, xDate As Date, Sh As Worksheet ', Msg As Boolean
- Sub Ie_Table()
- Dim URL As String, A As Object, i As Integer, E As Range
- Set_FormDLL
- URL = "http://stocker.com.tw/"
- xDate = Date - 1
- If Weekday(xDate, vbMonday) > 5 Then
- Do While Weekday(xDate, vbMonday) > 5
- xDate = xDate - 1
- Loop
- End If
- Set Sh = Sheets.Add 'µ²ªGÅã¥Ü¦b·s¼Wªº¤u§@ªí
- Sh.Name = Format(xDate, "yyyy-mm-dd") '©R¦W¬°¤é´Á
- With CreateObject("InternetExplorer.Application")
- .navigate URL
- .Visible = True
- For Each E In Sheets("¤U¸ü¥N¸¹¦W³æ").Range("A3", Sheets("¤U¸ü¥N¸¹¦W³æ").[A3].End(xlDown))
- Do While .Busy Or .ReadyState <> 4: Loop
- With .document.getElementsByTagName("input")
- .Item("StoNum").Value = E
- .Item("datestart").Value = Format(xDate, "yyyy-mm-dd")
- For i = 0 To .Length - 1
- If .Item(i).Type = "submit" Then .Item(i).Click
- Next
- End With
- Do While .Busy Or .ReadyState <> 4: Loop
- Set A = .document.getElementsByTagName("TABLE")
- Ep A(A.Length - 1).outerHTML
- Next
- .Quit
- End With
- Remove_FormDLL
- End Sub
- Sub Ep(S As String)
- Dim D As New DataObject, E As Shape
- 'DataObject ª«¥ó ¦b¶i¦æÂà´«°Ê§@®É¡A°µ¬°®æ¦¡¤Æ¤å¦r¸ê®Æªº¼È¦s°Ï°ì¡C¨ä¤]¥i¥H¼È¦s©MÀx¦s¦b DataObject ªº¤å¦r¤ù¬q¬ÛÃöªº®æ¦¡¡C
- '«Å§i Dim D As New DataObject '¶·¦b¤u¨ã-> ³]©w¤Þ¥Î¶µ¥Ø¥[¤J ·s¼W¤Þ¥Î Microsoft Forms 2.0 Object Library ,±M®× ¥[¤J¤@ªí³æ§Y¥i
- With D
- .SetText S
- .PutInClipboard
- With Sh.UsedRange
- If .Rows.Count = 1 Then
- .Cells(1).Select
- Else
- .Rows(.Rows.Count).Cells(2).Select
- End If
- Sh.PasteSpecial Format:="Unicode ¤å¦r"
- With ActiveCell
- .Cells(2, 1) = "¤é´Á"
- .Cells(3, 1).Resize(.Parent.UsedRange.Rows.Count - .Cells(3, 1).Row) = Format(xDate, "mm/dd")
- End With
-
- End With
- End With
- End Sub
- Sub Set_FormDLL() '·s¼W¤Þ¥Î Microsoft Forms 2.0 Object Library
- On Error Resume Next
- FormDLL = "FM20.DLL"
- ThisWorkbook.VBProject.References.AddFromFile "C:\windows\system32\FM20.DLL"
- '"C:\windows\system32\"¬O2003ª©ªº¸ô®|,2003¥H¤Wª©¥»»Ýקï¸ô®|
- End Sub
- Sub Remove_FormDLL() '§R°£¤Þ¥Î Microsoft Forms 2.0 Object Library
- Dim D As Object
- For Each D In ThisWorkbook.VBProject.References
- If UCase(D.fullpath) Like "*" & FormDLL Then
- ThisWorkbook.VBProject.References.Remove D
- End If
- Next
- End Sub
½Æ»s¥N½X |
|
|
|
|
|
|
- ©«¤l
- 36
- ¥DÃD
- 7
- ºëµØ
- 0
- ¿n¤À
- 76
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- 2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-10-1
- ³Ì«áµn¿ý
- 2016-3-21
|
¦^´_ jak
GBKEE µoªí©ó 2013-11-17 09:42
Y¬O§Ú·Qcopy¤U¦Cºô§}¬Y¤Ñ¡B¬Y´X®aªº¸ê®Æ¡Ahttp://stocker.com.tw/
¥i§_½Ð¤j¤j¼·¤¾À°¦£¡A¦³ªþÀÉ |
-
-
©ú²Ó.rar
(5.16 KB)
|
|
|
|
|
|
- ©«¤l
- 11
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 14
- ÂI¦W
- 0
- §@·~¨t²Î
- xp
- ³nÅ骩¥»
- 2007
- ¾\ŪÅv
- 10
- µù¥U®É¶¡
- 2011-9-17
- ³Ì«áµn¿ý
- 2017-4-24
|
ÁÂÁÂheavenweaver¡A¤S¾Ç¨ì¤@©Û¤F |
|
|
|
|
|
|
- ©«¤l
- 48
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 60
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-8-13
- ³Ì«áµn¿ý
- 2023-2-7
|
|
«Ü©êºp¡A§Ú¬O¤p¾Ç¥Í¡A¤£¯à¤U¸üÀɮסA¬OÓ¤p§¾«Ä¡I
|
|
|
|
|