|
楼主 |
发表于 2011-3-7 23:10
|
显示全部楼层
回复 108楼 pc_12 的帖子
帮你改出来了
原理和步骤:
1.修改IE.DOCUMENT.BODY.INNERHTML里面关于你查询窗口的点击后转向方式,由_blank的弹出窗口,改为_self的本窗口加载,
2.判断转向后的IE.LocationURL,为http://www.sdzs.gov.cn/putong/ptfs2010.aspx,方为所需的页面
3.等待所需查询页面加载后,再进行赋值,就可以赋值成功了。
Sub Getcj3()
'InternetExplorer和WebBrowser需引用Microsoft Internet Controls(SHDocVw.dll)
'On Error Resume Next
W = 1
Dim IE As Object
Dim a As Object
Dim doc As Object 'MSHTML.HTMLDocument
Dim txt As String
Dim i As Integer
Dim t1 As String
Dim t2 As String
Dim t3 As String
Dim b As String, c As String, d As String, j, k, h
'Cells.Clear
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate "http://www.sdzs.gov.cn/score/index.shtm"
IE.Visible = 0 'False
Do Until IE.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop
'Debug.Print IE.Document.body.innerhtml
IE.Document.body.innerhtml = Replace(IE.Document.body.innerhtml, "../putong/ptfs2010.aspx" & Chr(34) & " target=_blank", "../putong/ptfs2010.aspx" & Chr(34) & " target=_self")
'Debug.Print IE.Document.body.innerhtml
For Each a In IE.Document.getElementsByTagName("a")
If a.href = "http://www.sdzs.gov.cn/putong/ptfs2010.aspx" Then IE.Visible = 1: a.Click: Exit For
Next
Do Until IE.LocationURL = "http://www.sdzs.gov.cn/putong/ptfs2010.aspx"
DoEvents
Loop
Do Until IE.ReadyState = 4
DoEvents
Loop
'Debug.Print IE.Document.body.innerhtml
IE.Document.all("number").Value = ***** --------考号
IE.Document.all("Name").Value = **** --------------姓名
IE.Document.all("cardid").Value = *** ----------------密码
IE.Document.forms(0).submit
Do Until IE.ReadyState = 4
DoEvents
Loop
Application.Wait Time + TimeSerial(0, 0, 3)
DoEvents
Beep
Application.Wait Time + TimeSerial(0, 0, 1)
DoEvents
'IE.Quit
'Set IE = Nothing
End Sub
[ 本帖最后由 xmyjk 于 2011-3-7 23:12 编辑 ] |
|