- ©«¤l
- 15
- ¥DÃD
- 4
- ºëµØ
- 0
- ¿n¤À
- 27
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows
- ³nÅ骩¥»
- Win7
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2015-9-12
- ³Ì«áµn¿ý
- 2016-2-15
|
Hi GBKEE ¤j¤j
ÁÙ¬O¤£¦æC¡A©³¤U¬OVBA½X
1. ¶]¨ì Stop·|°±¤U¨Ó
2. ¦pªG§âStop®³±¼¡AIf element.Length < 7 Then ³o¤@¬q¤]¥ý®³±¼¡Aµ{¦¡ÁÙ¬O¶]¨ì For i = 0 To element(s).Rows.Length - 1 '¸ê®Æªº¦C¦ì¡A³o¤@¥y³ø¿ù¡A°õ¦æ¶¥¬q¿ù»~ '91': ¨S¦³³]©wª«¥óÅܼƩΠWith°Ï¶ôÅܼÆ
============================================
Sub ¶°«O§ì¨ú()
Dim A, element As Object, i As Integer, k As Integer, J As Integer, jj As Integer, s As Integer
With CreateObject("InternetExplorer.Application")
.Visible = True
.Navigate "http://www.tdcc.com.tw/smWeb/QryStock.jsp"
Do While .Busy Or .readyState <> 4: DoEvents: Loop
With .document
'-----¿é¤Jn¬d¸ßªºªÑ²¼¥N½X
For Each A In .getelementsbytagname("INPUT") '§äì©l½X¦³input°Ñ¼Æ
If A.Name = "StockNo" Then A.Value = Range("B1").Value '§äì©l½X¦³input°Ñ¼Æ¡A«á±ªºname =StockNo
Next
.ALL("SCA_DATE").SELECTEDINDEX = 2
.ALL("sub").Click
End With
Do While .Busy Or .readyState <> 4: DoEvents
Application.SendKeys "~", True '«ö ENTER «öÁä ,¹w¨¾ "ÃÒ¨é¥N¸¹"¦³¿ù»~
Loop
Do
Set element = .document.getelementsbytagname("table")
Loop Until Not element Is Nothing
MsgBox element.Length
'Stop
'If element.Length < 7 Then
'MsgBox "ÃÒ¨é¥N¸¹ ??": Exit Sub
'End If
With Sheets(1)
k = k + 1
For s = 5 To 7 '¤w§ä¥Xºô¶ªºtable¤º®e¦b 5-7 ¤¤
For i = 0 To element(s).Rows.Length - 1 '¸ê®Æªº¦C¦ì
For jj = 0 To element(s).Rows(i).Cells.Length - 1 '¸ê®ÆªºÄæ¦ì
.Cells(k, jj + 1) = element(s).Rows(i).Cells(jj).INNERTEXT
Next
k = k + 1
Next
Next
End With
End With
End Sub |
|