【发布时间】:2014-04-23 14:50:21
【问题描述】:
在通过获取 Html ID 并单击导出选项在下拉列表中选择一个项目后,我试图从 IE 导出文件,但是在保存文件时我被击中了。
我正在根据 excel 范围内的值选择下拉列表中的选项。
请帮忙。
下面是我正在尝试的代码。
Dim htm As Object
Dim IE As Object
Sub Website()
Dim Doc As Object
Set IE = CreateObject("internetexplorer.application")
IE.Visible = True
IE.navigate "http://**Link is confidential, sorry for not providing link**"
Do While IE.readystate <> 4: DoEvents: Loop
Set Doc = CreateObject("htmlfile")
Set Doc = IE.document
Set ref = Doc.getelementbyid("ReportViewerControl_ctl01_ctl05_ctl00")
For x = 0 To ref.Options.Length - 1
If ref.Options(x).Text = "Excel" Then
ref.selectedIndex = x
Set refclick = Doc.getelementbyid("ReportViewerControl_ctl01_ctl05_ctl01")
refclick.Click
Set refclick = Nothing
End If
Next
Set IE = Nothing
End Sub
还有快照我在这里被打动了,我想在这里保存文件。
【问题讨论】:
-
您好 Santosh,我正在尝试导出包含 1 个以上网页的报告。
-
您可以按照链接中的示例从屏幕中提取数据,而不是导出。
标签: internet-explorer excel save excel-2007 vba