View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Miller Dave Miller is offline
external usenet poster
 
Posts: 72
Default Automating download of csv files from web

This question is a very website specific question:

-Is the password a "Pop-up" input box?
if so, your URL should read "HTTP://
"

or embedded in the HTML?
if so, you would need to locate either the name of these text boxes
or the ID to be used in the code:

for example:

Sub SignIn()
Dim ie As Object
Dim sLinks() As String
Dim i As Integer

Set ie = CreateObject("InternetExplorer.Application")

With ie
.Visible = True
.navigate "HTTP://www.d-miller.com"
Do Until .readystate = 4
DoEvents
Loop
With .document
With .Forms(0)
.Item("UserName") = "YourUserName"
.Item("Password") = "YourPassword"
.Submit
End With
Do While ie.Busy
DoEvents
Loop
With .Links
For i = 0 To .Length - 1
ReDim Preserve sLinks(i) As String
sLinks(i) = .Item(i).href
Next
End With
End With

For i = 0 To UBound(sLinks)
.navigate sLinks(i)
Do Until .readystate = 4
DoEvents
Loop
With .document.all
For j = 0 To .Length
With .Item(j)
If .nodeName Like "TABLE" Then
With .Rows
For l = 0 To .Length - 1
With .Item(l).Cells
For c = 0 To .Length - 1
With .Item(c)
ActiveSheet.Cells(l +
1, c + 1) = .innerText
End With
Next
End With
Next
End With
End If
End With
Next j
End With
Next
End With
End Sub