我正在尝试使用VBA将数据从Excel提交到网络表单.问题发生在我试图选择和更新表单的*区域内.我尝试了各种选项(ID,名称等的getelement)没有任何成功.我认为这个问题与确定适当的要素有关.我已经看到有关在VBA中使用Locals功能的建议,但我不确定如何将其用于此目的.我有一种感觉,有一些经验的人可以通过查看网站上的源代码,使用VBA中的Locals或其他技术来快速解决这个问题.
表单已设置,因此所有字段都是文本,我可以在线输入/提交数据,没有任何问题.
在此先感谢您的任何帮助/建议.
Dim IE As Object
Sub submitFeedback3()
Application.ScreenUpdating = False
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "http://spreadsheetbootcamp.com/excel-efficiency-trainer-feedback/"
Application.StatusBar = "Submitting"
' Wait while IE loading...
While IE.Busy
DoEvents
Wend
**********************************************************************
IE.Document.getElementById("Form_Attempts-1372643500")(0).Value = "1"
IE.Document.getElementById("submit-1-1372643500")(0).Click
**********************************************************************
Application.StatusBar = "Form Submitted"
IE.Quit
Set IE = Nothing
Application.ScreenUpdating = True
End Sub
Run Code Online (Sandbox Code Playgroud)