[英]Excel VBA Javascript Export
我正在尝试从SQL Server Reporting Services站点导出报告,并且正在使用Excel 07和IE7。 我一直都有代码
Sub TestIE()
Dim IE2 As Object
Set IE2 = CreateObject("InternetExplorer.Application")
IE2.Visible = True
IE2.navigate "http://www.site.com"
Application.StatusBar = "Accessing the report"
Do While IE2.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
Dim CurrentWindow As HTMLWindowProxy: Set CurrentWindow = IE2.document.parentWindow
Call CurrentWindow.execScript("$find('ctl31')")
End Sub
我从中提取数据的网站将其显示为Javascript。
<div class="NormalButton">
<a class="ActiveLink" onclick="$find('ctl31').exportReport('EXCEL');"
href="javascript:void(0)" style="padding:3px 8px 3px 8px;display:block;
white-space:nowrap;text-decoration:none;">Excel</a>
当我运行宏时,此代码不执行任何操作。
Call CurrentWindow.execScript("$find('ctl31')")
但是,当我从网站Source使用以下代码时,出现运行时错误80020101。
Call CurrentWindow.execScript("$find('ctl31').exportReport('EXCEL');")
谁能推荐我可以做些什么来提取此数据?
因此,我已经在此文件上完成了基础工作。 我专门针对VBA的For Each过程打开了一个新问题,但此处的主要Javascript问题已关闭。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.