我正在尝试自动运行报告。到目前为止,我能够导航到报告页面并登录,但我仍然坚持如何在表单中输入数据来创建报告的参数(除了使用SendKeys,这似乎无效)
到目前为止,这是我的代码:
Dim HTMLDoc As HTMLDocument
Dim MyBrowser As InternetExplorer
Sub Login2()
Dim MyHTML_Element As IHTMLElement
Dim MyURL As String
MyURL = "https://mc.s7.exacttarget.com/cloud/#app/Email/Content/Tracking/SubscriberReports/AsyncReportCreate.aspx?r=/ExactTarget/Tracking Reports/Recent Email Sending Summary&HistoryNodeID=REPORT_HISTORY"
MyUsername = "*************"
MyPassword = "*************"
Set MyBrowser = New InternetExplorer
MyBrowser.Silent = True
MyBrowser.Top = 0
MyBrowser.Left = 0
MyBrowser.AddressBar = 0
MyBrowser.StatusBar = 0
MyBrowser.Toolbar = 0
MyBrowser.Visible = True
MyBrowser.Navigate MyURL
Do
Loop Until MyBrowser.ReadyState = 4
Set HTMLDoc = MyBrowser.document
HTMLDoc.all.UserName.Value = MyUsername
HTMLDoc.all.Password.Value = MyPassword
For Each MyHTML_Element In HTMLDoc.getElementsByTagName("input")
If MyHTML_Element.Type = "submit" Then MyHTML_Element.Click: Exit For
Next
Do
Loop Until MyBrowser.ReadyState = 4
HTMLDoc.getElementsById("ReportParameterPicker1_rp_StartDate_picker").Value = "2014.01.01.0.0.0"
End Sub
我得到运行时错误'438:对象不支持方法的这个属性。
报告表格的屏幕截图: [网址] https://gyazo.com/db1a5e7d74bc836e771b7915d33f5abd[/url]
理想情况下,我想滚动表单,填写输入区域,并在Excel表格中填充数据。
我尝试这样做时遇到的另一个问题是程序试图在网页完全加载之前采取行动,即使我在那里有“ReadyState”部分。
任何帮助将不胜感激!
谢谢!