你能从另一个Sub调用一个对象吗?

时间:2014-10-29 11:41:44

标签: excel internet-explorer

我对VBA很新。我有一个项目,我正在工作,我需要让工具循环通过excel表和4个IE页面。我有一个打开IE页面的Sub例程。在页面打开之后,我现在需要做的是循环遍历它们以及编写代码的excel文档,以及一旦焦点从页面移开就刷新IE页面。这些循环需要以5秒的间隔进行。这是打开IE页面的子例程。不太确定从哪里开始。任何帮助将不胜感激。

Sub openPendings()
Dim IE1 As Object
Dim IE2 As Object
Dim IE3 As Object
Dim IE4 As Object
Dim IE5 As Object

Set IE1 = CreateObject("InternetExplorer.Application")
Set IE2 = CreateObject("InternetExplorer.Application")
Set IE3 = CreateObject("InternetExplorer.Application")
Set IE4 = CreateObject("InternetExplorer.Application")
Set IE5 = CreateObject("InternetExplorer.Application")

IE1.navigate "https://www.google.com" 'Pending Issues
apiShowWindow IE1.hwnd, SW_MAXIMIZE
IE2.navigate "https://www.yahoo.com" 'Pending Issues
apiShowWindow IE2.hwnd, SW_MAXIMIZE
IE3.navigate "https://www.ebay.com" 'Pending Issues
apiShowWindow IE3.hwnd, SW_MAXIMIZE
IE4.navigate "https://www.espn.com" 'Pending Issues
apiShowWindow IE4.hwnd, SW_MAXIMIZE
IE5.navigate "http://www.nfl.com" 'Current issues
apiShowWindow IE5.hwnd, SW_MAXIMIZE
End Sub

0 个答案:

没有答案