- ©«¤l
- 1
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 2
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7
- ³nÅ骩¥»
- IE10
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2015-8-11
- ³Ì«áµn¿ý
- 2015-8-26
|
[µo°Ý] ½Ð°Ý n¦p¦ó¤~¯à±N¤WÂdªÑ²¼ st43.php ¥H VBA submit °õ¦æ?
¥»©«³Ì«á¥Ñ PT21 ©ó 2015-8-11 10:30 ½s¿è
ps:ì¿ùµo¦bExcel¤@¯ë°Ï
§Ú¬Oªì¾ÇªÌ,ª¦¤å«á§Û¤U¥H¤U code , ¦ý³£¦b oNode.ParentNode.submit ¿ù»~
n¦p¦ó¼g excel VBA , ¦b®Ø¤¤«ö "enter" Åý¥¦°õ¦æ©O?
oNode.ParentNode.submit n¦p¦ó¥Î©O?
½Ðºô¤W°ª¤âÀ°¦£ , ·PÁ¤F
Sub ½L«á¸ê°T_¤WÂd·í¦~«×¤é¦¬½L¦æ±¡()
Dim A As Object, oNode As Object, oIE As Object, co_id As String
xYear = Year(Date)
xMonth = Month(Date)
xYM = DateSerial(xYear, xMonth, 1)
co_id = "5347"
Set oIE = CreateObject("InternetExplorer.Application")
With oIE
.Visible = True
.Navigate "http://www.tpex.org.tw/web/stock/aftertrading/daily_trading_info/st43.php?l=zh-tw"
Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
.document.all("input_date").Value = Format(xYM, "E/MM")
.document.all("input_date").onchange
Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
Set oNode = .document.all("input_stock_code")
oNode.Value = co_id
oNode.ParentNode.submit
Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
Application.Wait Now + TimeValue("00:00:03")
Set A = .document.getElementsByTagName("table")
.document.BODY.innerHTML = A(0).outerHTML '¨ú²Ä1Ó"table"
Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
.ExecWB 17, 2 ' Select All
.ExecWB 12, 2 ' Copy selection
'.Quit 'Ãö³¬ºô¶
Sheets("¤u§@ªí1").Select
With ActiveSheet '¥i«ü©w¤u§@ªí
.UsedRange.Clear
.Range("A1").Select
.PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:=False, NOHTMLFormatting:=True
End With
End With
End Sub |
|