Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 2573|回复: 1

运行时错误445,对象不支持该动作,纠结好久啦,请大神帮忙给看一下好吗,谢谢啦。

[复制链接]
发表于 2014-11-19 15:11 | 显示全部楼层 |阅读模式
网上抄来的一段代码,(ˇ?ˇ) 想实现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


excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
发表于 2014-11-19 19:38 | 显示全部楼层
运行这段代码的工作簿路径下,有没有Preview.htm?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-5-6 06:35 , Processed in 0.290703 second(s), 12 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表