All Desired files won't download of a webpage - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

All Desired files won't download of a webpage

IanLevitanIanLevitan Posts: 1Member
So I'm trying to download four files off a webpage (all .csv files) and save them to the desktop. I access each file using it's ID number from the webpage source code (As seen in pasted code below). However, I think the timing if off because everytime I run it I miss one to two files and each time I run the program, it is a different two files. Any help would be great.


I have the inserted
"While ie.busy
DoEvents
Wend"
Still in because I thought that would help out with the timing of the program.

[u]Code:[/u]
Sub hh()
Dim ie As Object
Set ie = CreateObject("internetexplorer.application")

ie.Visible = True

ie.navigate "http://sbsprd2.natfuel.com/psc/sbsprd/NFSBS/sbsprd/c/NFOM_INFORMATIONAL_POSTINGS.NFOC_OPER_AVAIL_1.GBL"

While ie.busy
DoEvents
Wend


ie.document.getElementById("NF_WRK_NF_FLOW_DT_FROM").Value = InputBox("Beginning Date")
ie.document.all("NF_WRK_NF_FLOW_DT_THRU").Click
While ie.busy
DoEvents
Wend
ie.document.all("NF_WRK_NF_SELECTED_SW").Click

While ie.busy
DoEvents
Wend

ie.document.all("NF_WRK_NF_DESCR254_2$1").Click
While ie.busy
DoEvents
Wend
ie.document.all("NF_WRK_NF_DESCR254_2$7").Click
While ie.busy
DoEvents
Wend
ie.document.all("NF_WRK_NF_DESCR254_2$13").Click
While ie.busy
DoEvents
Wend
ie.document.all("NF_WRK_NF_DESCR254_2$19").Click


While ie.busy
DoEvents
Wend

ie.document.all("$ICField11").Click

While ie.busy
DoEvents
Wend

ie.document.all("NF_WRK_NF_DESCR254_2$1").Click
While ie.busy
DoEvents
Wend
ie.document.all("NF_WRK_NF_DESCR254_2$7").Click
While ie.busy
DoEvents
Wend
ie.document.all("NF_WRK_NF_DESCR254_2$13").Click
While ie.busy
DoEvents
Wend
ie.document.all("NF_WRK_NF_DESCR254_2$19").Click
End Sub

Sign In or Register to comment.