Function WSJ_PROCESS()
Set objIE = CreateObject("InternetExplorer.Application")
'objIE.Top = 0
'objIE.Left = 0
'objIE.Width = 0
'objIE.Height = 0
'objIE.Visible = True
objIE.navigate "http://www.wsj.com/mdc/public/page/2_3020-libor.html"
Do
DoEvents
Loop Until objIE.ReadyState = READYSTATE_COMPLETE
Dim Doc As HTMLDocument
Set Doc = objIE.Document
Dim MyList As String
y = 0
For x = 1 To 28
MyList = Trim(Doc.getElementsByClassName("num")(y).InnerText)
If y = 8 Then
'Libor1Month
Libor1 = MyList
End If
If y = 16 Then
'Libor3Month
Libor3 = MyList
End If
If y = 20 Then
'Libor6Month
Libor6 = MyList
End If
y = y + 1
Next x
y = 0
Dim db2 As DAO.Database
Dim rs2 As DAO.Recordset
Set db2 = CurrentDb
'Set rs = New ADODB.Recordset
Set rs2 = db2.OpenRecordset("select * from WSJ")
If rs2.Updatable Then
'It is possible that the record you want to update
'is locked by another user. If we don't check before
'updating, we will generate an error
rs2.AddNew
'Must start an update with the edit statement
rs2.Fields("[MyDate]") = Now
rs2.Fields("[Libor1]") = Libor1
rs2.Fields("[Libor3]") = Libor3
rs2.Fields("[Libor6]") = Libor6
'Another way of accessing the fields would be to use
'.fields("FirstName") = z" & .fields("FirstName")
rs2.Update
End If
rs2.Close
'MsgBox "Process Updated Successfully"
End Function
-----------------------------------------------------------------------------------------------------------------------------------
Function WSJ_PROCESS2()
Set objIE = CreateObject("InternetExplorer.Application")
'objIE.Top = 0
'objIE.Left = 0
'objIE.Width = 0
'objIE.Height = 0
'objIE.Visible = True
objIE.navigate "http://www.wsj.com/mdc/public/page/2_3020-moneyrate.html"
Do
DoEvents
Loop Until objIE.ReadyState = READYSTATE_COMPLETE
Dim Doc As HTMLDocument
Set Doc = objIE.Document
Dim MyList As String
y = 0
For x = 1 To 100
MyList = Trim(Doc.getElementsByClassName("num")(y).InnerText)
If y = 2 Then
'Prime Rate US
PrimeRateUS = MyList
End If
If y = 86 Then
'Commercial Paper 30 to 270 days Last Week
CommercialPaper30To120LastWeek = MyList
End If
If y = 87 Then
'Libor6Month
CommercialPaper30To120WeekAgo = MyList
End If
y = y + 1
Next x
Dim db2 As DAO.Database
Dim rs2 As DAO.Recordset
Set db2 = CurrentDb
'Set rs = New ADODB.Recordset
Set rs2 = db2.OpenRecordset("select * from WSJ2")
If rs2.Updatable Then
'It is possible that the record you want to update
'is locked by another user. If we don't check before
'updating, we will generate an error
rs2.AddNew
'Must start an update with the edit statement
rs2.Fields("[MyDate]") = Now
rs2.Fields("[PrimeRate]") = PrimeRateUS
rs2.Fields("[CommPaperLW]") = CommercialPaper30To120LastWeek
rs2.Fields("[CommPaperWA]") = CommercialPaper30To120WeekAgo
'Another way of accessing the fields would be to use
'.fields("FirstName") = z" & .fields("FirstName")
rs2.Update
End If
rs2.Close
MsgBox "Process Updated Successfully"
End Function