- ©«¤l
- 151
- ¥DÃD
- 25
- ºëµØ
- 0
- ¿n¤À
- 194
- ÂI¦W
- 1
- §@·~¨t²Î
- WINDOWS 10
- ³nÅ骩¥»
- Office 2010 ©Î 2021
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2011-9-6
- ³Ì«áµn¿ý
- 2024-11-8
|
¦^´_ 25# peter460191
¸Õ¸Õ¬Ý¥H¤Uªºµ{¦¡½X¡G¦ý½Ð¥ý¦b§Aªº Excel ¤u§@ªí «Ø¥ß¤TÓ¤u§@ªí¡A¦WºÙ¤À§O¬° "¤WÂd"¡B"¥iÂà¶Å"¡B"¿³Âd"¡A§_«hµ{¦¡·|¥X¿ù....
Sub ¤WÂd_¥iÂà¶Å_¿³Âd()
'¤WÂd
Application.ScreenUpdating = False
Sheets("¤WÂd").Select
DATE_REQ = CDate(Format(Now(), "yyyy/m/d"))
PPP1: yyymmdd = Year(DATE_REQ) - 1911 & Format(Month(DATE_REQ), "00") & Format(Day(DATE_REQ), "00")
Application.DisplayAlerts = False
On Error Resume Next
Cells.Select
Selection.QueryTable.Delete
Selection.ClearContents
Range("A1").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.otc.org.tw/ch/stock/aftertrading/DAILY_CLOSE_quotes/RSTA3104_" & yyymmdd & ".html" _
, Destination:=Range("$A$1"))
.Name = "RSTA3104_" & yyymmdd & ""
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
On Error GoTo 0
Columns("A:A").ColumnWidth = 7
If Cells(1, "A") = "" Then
DATE_REQ = DATE_REQ - 1
GoTo PPP1
End If
Sheets("¥iÂà¶Å").Select
yyyymmdd = Year(DATE_REQ) & Format(Month(DATE_REQ), "00") & Format(Day(DATE_REQ), "00")
On Error Resume Next
Cells.Select
Selection.QueryTable.Delete
Selection.ClearContents
Range("A1").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.otc.org.tw/ch/inc/js/ReportCSV.php?NAME=/ch/bond_trading_info/bonds_info/daily/data/rsta0113." & yyyymmdd & "-C.csv&SHOW=1&LEVEL=4" _
, Destination:=Range("$A$1"))
.Name = "rsta0113." & yyyymmdd & "-C.csv&SHOW=1&LEVEL=4_1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
On Error GoTo 0
Columns("A:A").ColumnWidth = 17.75
'¿³Âd
Sheets("¿³Âd").Select
Cells.Select
On Error Resume Next
Selection.QueryTable.Delete
Selection.ClearContents
Range("A1").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://nweb.gretai.org.tw/emgstk/ch/emgstk.htm", Destination:=Range( _
"$A$1"))
.Name = "emgstk_1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
On Error GoTo 0
Columns("A:A").ColumnWidth = 15.88
Columns("B:B").ColumnWidth = 13.13
End Sub |
|