Solved how can I for each item in IP before the sub?

March 4, 2015 at 10:35:36
Specs: Windows 7

Dim IP(1)
IP(0) = "10.202.15.31"
IP(1) = "10.202.15.32"
'IP(2) = "10.202.15.21"
'IP(3) = "10.202.15.22"
'IP(4) = "10.202.15.31"
'IP(5) = "10.202.15.32"
'IP(6) = "10.202.15.51"
'IP(7) = "10.202.15.52"
'IP(8) = "10.202.15.72"
'IP(9) = "10.202.15.74"
'IP(10) = "10.202.15.81"
'IP(11) = "10.202.15.82"
'IP(12) = "10.202.15.91"
'IP(13) = "10.202.15.92"
'IP(14) = "10.202.15.101"
'IP(15) = "10.202.15.102"
'IP(16) = "10.202.15.111"
'IP(17) = "10.202.15.112"

For Each item In IP
Set fso = CreateObject("Scripting.FileSystemObject")
Set ie = WScript.CreateObject("InternetExplorer.Application", "IE_")
ie.Navigate "\\" & item & "\share\STATS\BATCH\report.html"
ie.Visible = True
next

While True 'Script exit handled by IE_OnQuit
WScript.Sleep 10
Wend

Sub IE_DocumentComplete (pDisp, URL)
dir = fso.GetParentFolderName(URL) & "\"
with CreateObject("excel.application")
.visible = True
.Workbooks.Open URL
.visible = True
.DisplayAlerts = False 'disable the overwrite prompt, just do it!
.ActiveSheet.Saveas ("C:\Users\dstevens\Desktop\Reports\" & item & "\" & "Report.xls")
.Workbooks.Close
.Quit
WScript.Quit
IE_OnQuit()
end with
End Sub


See More: how can I for each item in IP before the sub?

Report •

#1
March 11, 2015 at 07:17:46
✔ Best Answer
Not sure what you're trying to do, but you do explicitly call WScript.Quit, so you'll never get past one document load.

How To Ask Questions The Smart Way


Report •
Related Solutions


Ask Question