- ©«¤l
- 9
- ¥DÃD
- 3
- ºëµØ
- 0
- ¿n¤À
- 12
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- SP3
- ¾\ŪÅv
- 10
- µù¥U®É¶¡
- 2010-7-23
- ³Ì«áµn¿ý
- 2024-7-21
|
vba¶×¤J¨é°Ó¶i¥Xªí
thanks.rar (12.69 KB)
http://yamstock.megatime.com.tw/asp/stockinfo/ps_top.asp?m=all&stockid=3474&name1=D2&index1=6
³o¬Oyan¨é°Ó¶i¥Xªí
·Q¥Îvba¶×¤Jexcel «ü©w¤u§@ï¤Î¦sÀx®æ
¦p2888·s¥úª÷¶×¤J"sheet2", "A1"
2409¤Í¹F¶×¤J"sheet2", "A60"
¥H¤Uµ{¦¡½X¬O§Úºô¸ô·j´M¨Ã¨Ì§Úªº»Ýn¦Û¦æ俢§ï
¦ý¬OÁÙ¬OµLªk°õ¦æ
½Ð«e½úÀ°¦£¬Ý¬Ý
¨ì©³¨º¸Ì¿ù»~ ÁÂÁÂ
Sub GetTransInfo()
Worksheets("sheet2").Activate
Call ¨é°Ó¶i¥X("2888", "sheet2", "A1")
Call ¨é°Ó¶i¥X("2409", "sheet2", "A60")
End Sub
Sub ¨é°Ó¶i¥X(stock As String, tsheet As String, tcell As String)
Call¨é°Ó¶i¥X("all&stockid", "8,10,11", stockinfo, tsheet, tcell)
End Sub
Sub¨é°Ó¶i¥X(all&stockid, tbl As String, stock As String, tsheet As String, tcell As String)
With Worksheets(tsheet).QueryTables.Add(Connection:="URL;http://yamstock.megatime.com.tw/asp/stockinfo/ps_top.asp?m=all&stockid=" & _
stockNo & "&name1=D2&index1=6, _
.Destination:=Worksheets(tsheet).Range(tcell))
.Name = all & "_" & stock
.FieldNames = True
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = tbl
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub |
|