Excel到Web自动化

时间:2012-05-13 08:55:45

标签: vbscript automation

以下是我通过Macro Automation->

尝试做的事情

- >我正在尝试打开网站[url] http://www.metaboanalyst.ca/MetaboAnalyst/faces/Home.jsp [/ url]

- >然后点击“点击此处开始”

- >然后检查“峰值强度表”的单选按钮

- >然后单击“浏览”数据文件并手动选择文件(File that needs to be selected)。

- >然后最后点击提交按钮(这不起作用,文件的路径在点击提交按钮时消失,并给我一个自动化错误['-2147352319(80020101)'])

除了最后一步提交 - >

之外,这里的代码工作正常
Sub MetaboAnn()

Dim IE As Object

Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True

IE.Navigate "http://www.metaboanalyst.ca/MetaboAnalyst/faces/Home.jsp"
Do Until IE.ReadyState = 4
DoEvents
Loop

Application.Wait (Now + TimeValue("0:00:05"))
'MsgBox "Done"
IE.Visible = True

IE.Document.getElementById("form1:groupPanel1:loginLink").Click

Application.Wait (Now + TimeValue("0:00:05"))
'MsgBox "Done"
IE.Visible = True

IE.Document.getElementById("form1:tabSet1:tab1:layoutPanel7:csvButtonGroup:csvButtonGroup_2_rb").Click

Application.Wait (Now + TimeValue("0:00:03"))
'MsgBox "Done"
IE.Visible = True

IE.Document.all("form1:tabSet1:tab1:layoutPanel7:statCsvUpload_com.sun.webui.jsf.upload").Click

Application.Wait (Now + TimeValue("0:00:03"))
'MsgBox "Done"
IE.Visible = True

IE.Document.getElementById("form1:tabSet1:tab1:layoutPanel7:csvSubmitButton").Click

End Sub

1 个答案:

答案 0 :(得分:0)

如果您使用的是IE,请尝试单击工具,然后单击“查看设置”并添加您所在的网站。它可能与该网站上的旧代码有关。