View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel[_622_] joel[_622_] is offline
external usenet poster
 
Posts: 1
Default How to load page with specific date?


I only selected US currency although you could select multipl
currencies


Sub OANDA()

URL = "https://fx2.oanda.com/user/interestrate.html"

StartDate = "01/01/1970"
EndDate = "02/02/2010"
MyCurrency = "US DOLLAR"

'Do
' MyStartDate = InputBox("Enter Start Date : ")
'Loop While Not IsDate(Response)

'StartDate = DateValue(MyStartDate)

'Do
' MyEndDate = InputBox("Enter End Date : ")
'Loop While Not IsDate(Response)

'EndDate = DateValue(MyEndDate)

Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True


'get web page
IE.navigate2 URL & Ticker
Do While IE.readystate < 4 Or _
IE.busy = True

DoEvents
Loop

Set FormInput = IE.document.getelementsbytagname("input")

FormInput(0).Value = Format(StartDate, "MM/DD/YYYY")
FormInput(1).Value = Format(EndDate, "MM/DD/YYYY")

Set ListBox = IE.document.getelementsbytagname("select")

Set ListboxItem = Nothing
For Each itm In ListBox(3)
If UCase(itm.innertext) = MyCurrency Then
Set ListboxItem = itm
Exit For
End If

Next

If ListboxItem Is Nothing Then
MsgBox ("could Not find currency - exiting Macro ")
Exit Sub
End If

ListboxItem.Selected = True

'submit form
FormInput(2).Select
FormInput(2).Click


Do While IE.readystate < 4 Or _
IE.busy = True

DoEvents
Loop

Set Mon_Sel = IE.document.getelementbyid("mon_sel")



Set Table = IE.document.getelementsbytagname("Table")

RowCount = 1
For Each Row In Table(2).Rows
ColCount = 1
For Each cell In Row.Cells

Cells(RowCount, ColCount) = cell.innertext
ColCount = ColCount + 1
Next cell
RowCount = RowCount + 1
Next Row

IE.Quit
End Su

--
joe
-----------------------------------------------------------------------
joel's Profile: 22
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=17542

[url=&quot;http://www.thecodecage.com&quot;]Microsoft Office Help[/url