VBA Internet Explorer的自动化 - 如何选取[开和QUOT;当下载文件 [英] VBA Internet Explorer Automation - How to Select "Open" When Downloading a File

查看:794
本文介绍了VBA Internet Explorer的自动化 - 如何选取[开和QUOT;当下载文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的第一个问题曾经在这里计算器!

我一直在寻找一个解决这个问题了一会儿,没有发现任何帮助。我可能只是在利用我的搜索错误的关键字,但到目前为止我没有运气。这里的问题:

在VBA中,我怎么能选择在Internet Explorer?

文件下载对话框的打开选项

只是为了澄清外,我说的是,当一个文件被下载横跨在IE9的屏幕下方弹出的橙黄色吧。

我在做一些VBA自动化下载数百使用Internet Explorer网页的PDF,但其中.fdf文件已被打开之前,我实际PDF的中间步骤。所以,我首先需要选择打开选项,这样我就可以继续自动化的下一个步骤。就像我刚才所说,我已经做了很多的搜索,并没有运气这么远。<​​/ P>

我在希望按Enter键将工作,这是最后的努力没有奏效使用的SendKeys尝试。

在此先感谢您的帮助!


解决方案

我已经涵盖广泛这种这里。

主题 VBA / VB.Net / VB6,点击打开/保存/取消按钮上的IE下载窗口 - 第一部分

链接:<一href=\"http://www.siddharthrout.com/2011/10/23/vbavb-netvb6click-opensavecancel-button-on-ie-download-window/\" rel=\"nofollow\">http://www.siddharthrout.com/2011/10/23/vbavb-netvb6click-opensavecancel-button-on-ie-download-window/


修改(IMP)如果你使用的是IE 9,不要忘记阅读第二部分,因为它包括占地IE 9下载​​窗口的窗口结构


主题 VBA / VB.Net / VB6,点击打开/保存/取消按钮上的IE下载窗口 - 第二部分

链接:<一href=\"http://www.siddharthrout.com/2012/02/02/vbavb-netvb6click-opensavecancel-button-on-ie-download-window-part-ii/\" rel=\"nofollow\">http://www.siddharthrout.com/2012/02/02/vbavb-netvb6click-opensavecancel-button-on-ie-download-window-part-ii/

上面的链接了解如何使用使用API​​的实现你想要的讨论。

从1st链接...


  

就像你和我,我们俩都有名字,类似于窗口有手柄(HWND),类等等。一旦你知道那是什么hWnd是,它更容易与该窗口进行交互。


  
  

FindWindow函数的API通过使用类名和在这种情况下,窗口(文件下载)的标题找到一个特定的窗口的hWnd。 打开,保存和取消按钮本身的窗口,但它们是为文件下载主窗口的子窗口。这意味着那些每个人也会有一个HWND :)要找到孩子的窗户,我们不使用FindWindow函数,但使用FindWindowEx。所有三个按钮打开,保存和取消具有相同的类,这是按钮。


This is my first question ever here on stackoverflow!

I've been searching for a solution to this problem for a while and haven't found any help. I may just be using the wrong keywords in my searches, but so far I've had no luck. Here's the question:

In VBA, how can I select the "Open" option from the file download dialog in Internet Explorer?

Just for extra clarification, I'm talking about the yellow-orange bar that pops up across the bottom of the screen in IE9 when a file is downloaded.

I'm doing some VBA automation to download hundreds of PDFs from the web using Internet Explorer, but there is an intermediate step where a .fdf file has to be opened before I get to the actual PDF. So I first need to select the "Open" option so that I can move on to the next step of the automation. Like I said earlier, I've done a lot of searching and had no luck so far.

I've tried using SendKeys in hopes that hitting Enter would work, and that was a last ditch effort that didn't work.

Thanks in advance for the help!

解决方案

I have covered this extensively here.

Topic: VBA/VB.Net/VB6–Click Open/Save/Cancel Button on IE Download window – PART I

Link: http://www.siddharthrout.com/2011/10/23/vbavb-netvb6click-opensavecancel-button-on-ie-download-window/

and


EDIT (IMP) If you are using IE 9 Do not forget to read PART 2 as it includes and covers the window structure of IE 9 download window


Topic: VBA/VB.Net/VB6–Click Open/Save/Cancel Button on IE Download window – PART II

Link: http://www.siddharthrout.com/2012/02/02/vbavb-netvb6click-opensavecancel-button-on-ie-download-window-part-ii/

The above links discuss on how to use use the API's to achieve what you want.

From the 1st link...

Like you and me, we both have names, similarly windows have "handles" (hWnd), Class etc. Once you know what that hWnd is, it is easier to interact with that window.

Findwindow API finds the hWnd of a particular window by using the class name and the caption of the window ("File Download") in this case. The "Open", "Save" and "Cancel" buttons are windows in itself but they are child windows of the main window which is "File Download". That means each one of those will also have a hWnd :) To find the child windows, we don’t use FindWindow but use FindWindowEx. All the three buttons "Open", "Save" and "Cancel" have the same class which is " Button".

这篇关于VBA Internet Explorer的自动化 - 如何选取[开和QUOT;当下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆