Consulting

Results 1 to 4 of 4

Thread: API Help Needed

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Newbie
    Joined
    Jan 2018
    Posts
    1
    Location

    API Help Needed

    Hi everyone,
    I am working on my first code and I am trying to scrape data from the Federal Reserve.


    Here is my code:

    Sub CivilianUnemployment()
    
    Dim wx As Worksheet: Set ws = Worksheets("API")
    
    Dim strURL As String
    strURL = ws.[FRED]
    
    Dim hReq As New WinHttpRequest
    hReq.Open "GET", strURL, False
    hReq.Send
    
    Dim strReq As String
    strResp = hReq.ResponseText
    
    Dim xmlDoc As New MSXML2.DOMDocument60
    If Not xmlDoc.LoadXML(strResp) Then
        MsgBox "Load error"
    End If
    
    Dim xnodelist As MSXML2.IXMLDOMNodeList
    Set xnodelist = xmlDoc.getElementsByTagName("observations")
    
    Dim xnode As MSXML2.IXMLDOMNode
    Set xnode = xnodelist.Item(0)
    
    Dim obAtt1 As MSXML2.IXMLDOMAttribute
    Dim obAtt2 As MSXML2.IXMLDOMAttribute
    
    Dim xChild As MSXML2.IXMLDOMNode
    
    Dim intRow As Integer
    intRow = 2
    
    Dim strCol1 As String
    strCol1 = "A"
    Dim strCol2 As String
    strCol2 = "B"
    
    Dim dtVal As Date
    Dim dblRate As Double
    Dim strVal As String
    
    Set hReq = Nothing
    Set xmlDoc = Nothing
    
    End Sub

    No error messages show up, but when I run the program, nothing happens. If I could get any help for this that would be great. Thank you
    Last edited by SamT; 01-14-2018 at 05:24 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •