VBA ¤U¸ü¥æ©ö©Ò¸ê®ÆETF«e±ªº00·|¦Û°Ê¤£¨£¡An¦p¦ó×¥¿
- ©«¤l
- 2
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 52
- ÂI¦W
- 79
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- OFFICE 2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- Taiwan
- µù¥U®É¶¡
- 2012-8-8
- ³Ì«áµn¿ý
- 2024-11-26
|
VBA ¤U¸ü¥æ©ö©Ò¸ê®ÆETF«e±ªº00·|¦Û°Ê¤£¨£¡An¦p¦ó×¥¿
VBA ¤U¸ü¥æ©ö©Ò¸ê®ÆETF«e±ªº00·|¦Û°Ê¤£¨£¡An¦p¦ó×¥¿
§Ún§¹¾ãÃÒ¨é¥N¸¹¦³¥X²{
¦p¡GÆä0050Æå Æ䤸¤j¥xÆW50Æå·|Åܦ¨Æä50Æå Æ䤸¤j¥xÆW50Æå
µ{¦¡½X¦p¤U
Sub test()
Dim strGetDate As String '«Å§i¤é´Á
strGetDate = Format(Range("b1").Value, "YYYYMMDD") '®æ¦¡¤Æ¤é´Á
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;https://www.twse.com.tw/exchangeReport/TWTB4U?response=html&date=20190805&selectType=All" _
, Destination:=Range("$A$4"))
.Refresh BackgroundQuery:=False
.Delete
End With
End Sub |
|
|
|
|
|
|
- ©«¤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 ©ó 2020-4-24 19:40 ½s¿è
¦^´_ 1# frogfrer
¸Õ¸Õ¬Ý- Option Explicit
- Sub Ex()
- Dim Ar, R As Double, C As Integer, Ttitle As String, S As String
- With New InternetExplorer '¤Þ¥Î¶µ¥Ø¥[¤J Microsoft Internet Controls
- .Navigate "https://www.twse.com.tw/exchangeReport/TWTB4U?response=html&date=20200424&selectType=All"
- .Visible = True
- Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
- With .Document.all.TAGS("TABLE")(0)
- Ttitle = .Rows(0).innerText
- ReDim Ar(1 To .Rows.Length - 1, .Rows(1).Cells.Length - 1)
- For R = 1 To .Rows.Length - 1
- For C = 0 To .Rows(R).Cells.Length - 1
-
- Ar(R, C) = IIf(C = 0 And Mid(.Rows(R).Cells(C).innerText, 1, 1) = 0, "'", "") & .Rows(R).Cells(C).innerText
- 'IIf(C = 0 And Mid(.Rows(R).Cells(C).innerText, 1, 1) = 0, "'", "") '**ÃÒ¨é¥N¸¹0¶}ÀY¥[¤W'Âର¤å¦r
- Next
- Next
- End With
- .Quit
- End With
- With ActiveSheet '¥i§ó§ï¤u§@ªí
- .UsedRange.Clear
- .[a1] = Ttitle
- .[a2].Resize(UBound(Ar), 3) = Ar
- End With
- End Sub
½Æ»s¥N½X |
|
|
|
|
|
|