简体   繁体   English

Excel VBA Javascript导出

[英]Excel VBA Javascript Export

I am attempting to export a report from a SQL Server Reporting Services site, and am using Excel 07 and IE7. 我正在尝试从SQL Server Reporting Services站点导出报告,并且正在使用Excel 07和IE7。 I have the code all the way up 我一直都有代码

 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

The site that I'm pulling the data from shows this as it's Javascript. 我从中提取数据的网站将其显示为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>

When I run my macro, this code does nothing. 当我运行宏时,此代码不执行任何操作。

 Call CurrentWindow.execScript("$find('ctl31')")

But when I use the below code from the site Source, I get the Run Time Error 80020101. 但是,当我从网站Source使用以下代码时,出现运行时错误80020101。

 Call CurrentWindow.execScript("$find('ctl31').exportReport('EXCEL');")

Can anyone recommend what I can do to pull this data? 谁能推荐我可以做些什么来提取此数据?

So I got the basics done on this file. 因此,我已经在此文件上完成了基础工作。 I opened a new questions specificly for VBA's For Each procedure, but the main Javascript issue here is closed. 我专门针对VBA的For Each过程打开了一个新问题,但此处的主要Javascript问题已关闭。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM