自动打开下载的文件Excel VBA

时间:2016-03-13 02:53:13

标签: excel vba excel-vba

我有一些代码可以访问网站并登录。然后,它会按下“导出到Excel”按钮并获取另存为对话框。有什么方法可以按“打开”并打开文件吗?如果您需要网站上的任何HTML代码,请告知我们,因为这些信息是保密的。在此先感谢!!

Sub Download()
Set IE = New SHDocVw.InternetExplorer
IE.Visible = True
IE.navigate "http://broomfield.flatironslibrary.org/"

While IE.Busy
DoEvents
Wend
Do Until Not IE.Busy And IE.readyState = 4
DoEvents
Loop

 IE.document.getElementsByClassName("hidden-xs header-button header-primary")(0).Click
Application.Wait (Now + #12:00:02 AM#)
IE.document.getElementById("username").Value = "user"
IE.document.getElementById("password").Value = "pass"
IE.document.getElementsByClassName("btn btn-primary extraModalButton") (0).Click
Application.Wait (Now + #12:00:02 AM#)
IE.navigate ("http://broomfield.flatironslibrary.org/MyAccount/CheckedOut?exportToExcel")

   'This is where the dialog box appears
 End sub

0 个答案:

没有答案