|
网上抄来的一段代码,(ˇ?ˇ) 想实现excel数据自动导入网页的功能,但是在执行到Do Until .ReadyState = 4这句的时候报错误“运行时错误445,对象不支持该动作”,本人新手,实在不知道如何处理,请求大家帮助,谢谢!!
Option Explicit
Sub a()
Dim ie1 As Object, i As Long, x As Integer, y As Integer
Set ie1 = CreateObject("InternetExplorer.Application")
With ie1
.Navigate ThisWorkbook.Path & "\Preview.htm"
.Visible = True
Do Until .ReadyState = 4
DoEvents
Loop
For i = 2 To [a65536].End(3).Row
.Document.ALL("textfield1").Value = Cells(i, 1).Value
.Document.ALL("textfield2").Value = Cells(i, 2).Value
If Cells(i, 3).Value = "男" Then
x = 0
ElseIf Cells(i, 3).Value = "女" Then
x = 1
Else
MsgBox "性别错误"
End If
.Document.ALL("rbgroup")(x).Checked = True
If Cells(i, 4).Value = "初级" Then
y = 0
ElseIf Cells(i, 4).Value = "中级" Then
y = 1
ElseIf Cells(i, 4).Value = "高级" Then
y = 2
Else
MsgBox "职称错误"
End If
.Document.ALL("select1").Options(y).Selected = True
.Document.forms("form1").submit
Do Until .ReadyState = 4
DoEvents
Loop
Next
End With
Set ie1 = Nothing
MsgBox "运行完毕"
End Sub
|
|