-1
我一直使用VBA试图输入文本在IE浏览器,但我不断收到对象犯规支持此属性 的URL我想输入测试是 http://www.smartsurvey.co.uk/s/2XKL1/输入文本
我的代码
Sub inputusername()
Dim IE As Object
Dim name As String
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
currenttime = Hour(Now())
If currenttime < 12 Then
g01 = "Morning"
ElseIf currenttime >= 18 Then
g01 = "Evening"
Else
g01 = "Afternoon"
End If
'Me.embtn.Visible = True
'MsgBox (g01 & " " & Application.UserName)
If MsgBox(g01 & " " & Application.UserName & " Please input your name on the website?", vbYesNo + vbQuestion) = vbNo Then
name = InputBox("Please type in your name")
Else
name = Application.UserName
End If
'MsgBox (Name)
Set IE = CreateObject("InternetExplorer.Application")
With IE
.Visible = True
.Navigate ("http://www.smartsurvey.co.uk/s/2XKL1/")
Do While IE.Busy: DoEvents: Loop
IE.doucment.getelementsByName("t31092740").innertext = name
IE.document.getelementsByName("cmdGo").Item.Click
End With
' cleaning up memory
IE.Quit
Set IE = Nothing
MsgBox "Yippy Thanks"
End Sub
我试图与IE.doucment.getelementsByName("t31092740").innerhtml
更换IE.doucment.getelementsByName("t31092740").innertext
; IE.doucment.getelementsByID("t31092740").innertext
但保持歌厅对象不支持此属性或方法
谢谢洙大部分时间都在尝试一切 –
不客气。很高兴听到它解决了。 – smozgur